Fix mruby bindings #197

Open
pulsejet wants to merge 5 commits from pulsejet/mrb into master
1 changed files with 6 additions and 6 deletions
Showing only changes of commit a996d36047 - Show all commits

View File

@ -91,8 +91,7 @@ MRB_METHOD(fontInitializeCopy)
MRB_METHOD(FontGetName) MRB_METHOD(FontGetName)
{ {
/* FIXME: getName method is missing from Font */ return mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "name"));
return mrb_str_new_cstr(mrb, "name");
} }
MRB_METHOD(FontSetName) MRB_METHOD(FontSetName)
@ -106,6 +105,7 @@ MRB_METHOD(FontSetName)
names.push_back(RSTRING_PTR(name)); names.push_back(RSTRING_PTR(name));
f->setName(names); f->setName(names);
mrb_iv_set(mrb, self, mrb_intern_cstr(mrb, "name"), name);
return name; return name;
} }
@ -142,13 +142,12 @@ DEF_KLASS_PROP(Font, mrb_bool, DefaultItalic, "b", bool)
DEF_KLASS_PROP(Font, mrb_bool, DefaultOutline, "b", bool) DEF_KLASS_PROP(Font, mrb_bool, DefaultOutline, "b", bool)
DEF_KLASS_PROP(Font, mrb_bool, DefaultShadow, "b", bool) DEF_KLASS_PROP(Font, mrb_bool, DefaultShadow, "b", bool)
Ancurio commented 2018-04-29 09:34:13 +00:00 (Migrated from github.com)
Review

Same as with get/SetName, except that the IV is stored in the Class object.

Same as with get/SetName, except that the IV is stored in the Class object.
MRB_FUNCTION(FontGetDefaultName) MRB_METHOD(FontGetDefaultName)
{ {
/* FIXME: getDefaultName method is missing from Font */ return mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "default_name"));
return mrb_str_new_cstr(mrb, "default_name");
} }
MRB_FUNCTION(FontSetDefaultName) MRB_METHOD(FontSetDefaultName)
{ {
mrb_value nameObj; mrb_value nameObj;
mrb_get_args(mrb, "S", &nameObj); mrb_get_args(mrb, "S", &nameObj);
@ -157,6 +156,7 @@ MRB_FUNCTION(FontSetDefaultName)
names.push_back(RSTRING_PTR(nameObj)); names.push_back(RSTRING_PTR(nameObj));
Font::setDefaultName(names, shState->fontState()); Font::setDefaultName(names, shState->fontState());
mrb_iv_set(mrb, self, mrb_intern_cstr(mrb, "default_name"), nameObj);
return nameObj; return nameObj;
} }