Exemplo n.º 1
0
static VALUE Font_add(VALUE self, VALUE filename)
{
  ExportFilenameStringValue(filename);
  if(Kanji_AddFont(Get_Kanji_Font(self), RSTRING_PTR(filename)) == -1)
    rb_raise(eSDLError, "Couldn't use font: %s", RSTRING_PTR(filename));
  return Qnil;
}
Exemplo n.º 2
0
static VALUE Font_s_open(VALUE klass, VALUE filename, VALUE size)
{
  Kanji_Font* font;

  ExportFilenameStringValue(filename);
  
  font = Kanji_OpenFont(RSTRING_PTR(filename), NUM2INT(size));
  if(font == NULL)
    rb_raise(eSDLError,"Couldn't open bdf font: %s", RSTRING_PTR(filename));
  return Font_create(font);
}
Exemplo n.º 3
0
static VALUE Surface_s_load(VALUE klass, VALUE filename)
{
  SDL_Surface *surface;
  
  rb_secure(4);
  ExportFilenameStringValue(filename);

  surface = IMG_Load(RSTRING_PTR(filename));
  if(surface == NULL)
    rb_raise(eSDLError,"Couldn't load %s: %s",
             RSTRING_PTR(filename), SDL_GetError());
  return Surface_create(surface);
}