Module: Retrograph

Defined in:
ext/retrograph/retrograph.c

Defined Under Namespace

Classes: RenderError, VDU

Class Method Summary collapse

Class Method Details

._init_sdlObject



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'ext/retrograph/retrograph.c', line 256

static VALUE init_sdl(VALUE self) {
    VALUE rubysdl_version;
    mSDL = rb_const_get(rb_cObject, rb_intern("SDL"));

    rubysdl_version = rb_const_get(mSDL, rb_intern("VERSION"));
    if (!strncmp(StringValueCStr(rubysdl_version), "1.", 2)) {
        CREATE_SURFACE_METHOD_NAME = ID2SYM(rb_intern("new"));
        get_rubysdl_surface = get_rubysdl_surface_1_x;
    } else if (!strncmp(StringValueCStr(rubysdl_version), "2.", 2)) {
        CREATE_SURFACE_METHOD_NAME = ID2SYM(rb_intern("createWithFormat"));
        get_rubysdl_surface = get_rubysdl_surface_2_x;
    } else {
        rb_raise(rb_eLoadError, "Unrecognized Ruby/SDL version");
    }

    cSurface = rb_const_get(mSDL, rb_intern("Surface"));
    rb_define_method(cVDU, "render_frame_sdl", vdu_render_frame, 0);
}