MRuby: Fix handling of Etc/Font properties

Port of f8c26fc515.
This commit is contained in:
Jonas Kulla 2014-09-05 22:53:19 +02:00
parent 7f41b9cc45
commit 9461449cc9
9 changed files with 117 additions and 55 deletions

View file

@ -22,6 +22,7 @@
#include "bitmap.h"
#include "font.h"
#include "exception.h"
#include "sharedstate.h"
#include "disposable-binding.h"
#include "binding-util.h"
#include "binding-types.h"
@ -51,11 +52,15 @@ MRB_METHOD(bitmapInitialize)
/* Wrap properties */
Font *font = new Font();
b->setFont(font);
font->setColor(new Color(*font->getColor()));
b->setInitFont(font);
font->initDynAttribs();
wrapProperty(mrb, self, font, CSfont, FontType);
wrapProperty(mrb, getProperty(mrb, self, CSfont), font->getColor(), CScolor, ColorType);
mrb_value fontProp = wrapProperty(mrb, self, font, CSfont, FontType);
wrapProperty(mrb, fontProp, font->getColor(), CScolor, ColorType);
if (rgssVer >= 3)
wrapProperty(mrb, fontProp, font->getOutColor(), CSout_color, ColorType);
return self;
}
@ -292,7 +297,6 @@ MRB_METHOD(bitmapSetFont)
font = getPrivateDataCheck<Font>(mrb, fontObj, FontType);
GUARD_EXC( b->setFont(font); )
setProperty(mrb, self, CSfont, fontObj);
return mrb_nil_value();
}