Module: SDL

Defined in:
lib/graphics/simulation.rb,
lib/graphics/simulation.rb,
ext/sdl/sdl.c

Overview

:nodoc:

Defined Under Namespace

Modules: Key, Mouse Classes: Audio, CollisionMap, Error, Event, PixelFormat, Renderer, Screen, Surface, TTF, Texture, Window

Class Method Summary collapse

Class Method Details

.init(flags) ⇒ Object

// SDL methods:



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'ext/sdl/sdl.c', line 140

static VALUE sdl_s_init(VALUE mod, VALUE flags) {
  UNUSED(mod);
  if (SDL_Init(NUM2UINT(flags)))
    FAILURE("SDL.init");

  if (TTF_Init())
    rb_raise(eSDLError, "TTF_Init error: %s", TTF_GetError());

  SDL_Rect r;
  if (SDL_GetDisplayBounds(0, &r) != 0) {
    rb_raise(eSDLError, "Failure calling SDL_GetDisplayBounds()");
    return 1;
  }

  rb_const_reset(cScreen, id_W, UINT2NUM(r.w));
  rb_const_reset(cScreen, id_H, UINT2NUM(r.h));

  return Qnil;
}