Sha256: fc76f5d62a5bef4126ac1ed410c592c74c0a0823f73fa0b69bda40ab5c7a47f1

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

#include "ruby.h"

#if defined(HAVE_SDL_H) || defined(RAY_USE_FRAMEWORK)
# include <SDL.h>
#else
# include <SDL/SDL.h>
#endif

#ifdef __cplusplus
extern "C" {
#if 0
}
#endif
#endif

/* Classes and modules */
extern VALUE ray_mRay;

extern VALUE ray_cImage;
extern VALUE ray_cColor;
extern VALUE ray_cRect;

/* Macros for Ruby's C API */

#define RAY_IS_A(obj, klass) (RTEST(rb_obj_is_kind_of(obj, klass)))

#define RAY_OBJ_CLASSNAME(obj) (rb_class2name(rb_class_of(obj)))

#define RAY_SYM(string) (ID2SYM(rb_intern(string)))
#define RAY_METH(string) (rb_intern(string))

/* Data types */

typedef struct {
   VALUE self;
   SDL_Surface *surface;

   int mustFree; /* Should we call SDL_FreeSurface? */
} ray_image;

typedef struct {
   uint8_t r, g, b, a;
} ray_color;

typedef SDL_Rect ray_rect;

/* Convertion functions */

/** Converts a surface into a ruby object */
VALUE ray_create_image(SDL_Surface *surface);

/** Converts a color into a ruby object */
VALUE ray_col2rb(ray_color color);

/** Converts a rect into a ruby object */
VALUE ray_rect2rb(ray_rect rect);

/** Converts a ruby object into a color */
ray_color ray_rb2col(VALUE object);

/** Converts a ruby object into an image*/
ray_image *ray_rb2image(VALUE object);

/** Converts a ruby object into a color */
SDL_Surface *ray_rb2surface(VALUE object);

/** Converts a ruby object into a rect */
ray_rect ray_rb2rect(VALUE object);

/* Initilizers */

void Init_ray_ext();
void Init_ray_image();
void Init_ray_color();
void Init_ray_rect();

#ifdef __cplusplus
#if 0
{
#endif
}
#endif

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ray-0.0.0.pre1 ext/ray.h