Pass value object attributes by reference (instead of pointer)
This underlines that no reference inside the setter is taken, and that these attributes are non-nullable. Also removes a couple of superfluous attribute macros.
This commit is contained in:
parent
5549ff78f0
commit
c9d5059238
|
@ -340,7 +340,7 @@ rb_check_argc(int actual, int expected)
|
||||||
VALUE propObj = *argv; \
|
VALUE propObj = *argv; \
|
||||||
PropKlass *prop; \
|
PropKlass *prop; \
|
||||||
prop = getPrivateDataCheck<PropKlass>(propObj, PropKlass##Type); \
|
prop = getPrivateDataCheck<PropKlass>(propObj, PropKlass##Type); \
|
||||||
GUARD_EXC( k->set##PropName(prop); ) \
|
GUARD_EXC( k->set##PropName(*prop); ) \
|
||||||
return propObj; \
|
return propObj; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,10 +60,10 @@ RB_METHOD(fontInitialize)
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
f->initDynAttribs();
|
f->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(self, f->getColor(), "color", ColorType);
|
wrapProperty(self, &f->getColor(), "color", ColorType);
|
||||||
|
|
||||||
if (rgssVer >= 3)
|
if (rgssVer >= 3)
|
||||||
wrapProperty(self, f->getOutColor(), "out_color", ColorType);
|
wrapProperty(self, &f->getOutColor(), "out_color", ColorType);
|
||||||
|
|
||||||
if (NIL_P(name))
|
if (NIL_P(name))
|
||||||
name = rb_iv_get(rb_obj_class(self), "default_name");
|
name = rb_iv_get(rb_obj_class(self), "default_name");
|
||||||
|
@ -90,10 +90,10 @@ RB_METHOD(fontInitializeCopy)
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
f->initDynAttribs();
|
f->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(self, f->getColor(), "color", ColorType);
|
wrapProperty(self, &f->getColor(), "color", ColorType);
|
||||||
|
|
||||||
if (rgssVer >= 3)
|
if (rgssVer >= 3)
|
||||||
wrapProperty(self, f->getOutColor(), "out_color", ColorType);
|
wrapProperty(self, &f->getOutColor(), "out_color", ColorType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ RB_METHOD(FontSetDefaultOutColor)
|
||||||
|
|
||||||
Color *c = getPrivateDataCheck<Color>(colorObj, ColorType);
|
Color *c = getPrivateDataCheck<Color>(colorObj, ColorType);
|
||||||
|
|
||||||
Font::setDefaultOutColor(c);
|
Font::setDefaultOutColor(*c);
|
||||||
|
|
||||||
return colorObj;
|
return colorObj;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ RB_METHOD(FontSetDefaultColor)
|
||||||
|
|
||||||
Color *c = getPrivateDataCheck<Color>(colorObj, ColorType);
|
Color *c = getPrivateDataCheck<Color>(colorObj, ColorType);
|
||||||
|
|
||||||
Font::setDefaultColor(c);
|
Font::setDefaultColor(*c);
|
||||||
|
|
||||||
return colorObj;
|
return colorObj;
|
||||||
}
|
}
|
||||||
|
@ -266,11 +266,11 @@ fontBindingInit()
|
||||||
rb_define_alloc_func(klass, classAllocate<&FontType>);
|
rb_define_alloc_func(klass, classAllocate<&FontType>);
|
||||||
|
|
||||||
Font::initDefaultDynAttribs();
|
Font::initDefaultDynAttribs();
|
||||||
wrapProperty(klass, Font::getDefaultColor(), "default_color", ColorType);
|
wrapProperty(klass, &Font::getDefaultColor(), "default_color", ColorType);
|
||||||
rb_iv_set(klass, "default_name", rb_str_new_cstr(Font::getDefaultName()));
|
rb_iv_set(klass, "default_name", rb_str_new_cstr(Font::getDefaultName()));
|
||||||
|
|
||||||
if (rgssVer >= 3)
|
if (rgssVer >= 3)
|
||||||
wrapProperty(klass, Font::getDefaultOutColor(), "default_out_color", ColorType);
|
wrapProperty(klass, &Font::getDefaultOutColor(), "default_out_color", ColorType);
|
||||||
|
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultName, "default_name");
|
INIT_KLASS_PROP_BIND(Font, DefaultName, "default_name");
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultSize, "default_size");
|
INIT_KLASS_PROP_BIND(Font, DefaultSize, "default_size");
|
||||||
|
|
|
@ -35,8 +35,8 @@ RB_METHOD(planeInitialize)
|
||||||
|
|
||||||
p->initDynAttribs();
|
p->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(self, p->getColor(), "color", ColorType);
|
wrapProperty(self, &p->getColor(), "color", ColorType);
|
||||||
wrapProperty(self, p->getTone(), "tone", ToneType);
|
wrapProperty(self, &p->getTone(), "tone", ToneType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@ RB_METHOD(spriteInitialize)
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
s->initDynAttribs();
|
s->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(self, s->getSrcRect(), "src_rect", RectType);
|
wrapProperty(self, &s->getSrcRect(), "src_rect", RectType);
|
||||||
wrapProperty(self, s->getColor(), "color", ColorType);
|
wrapProperty(self, &s->getColor(), "color", ColorType);
|
||||||
wrapProperty(self, s->getTone(), "tone", ToneType);
|
wrapProperty(self, &s->getTone(), "tone", ToneType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,9 +64,9 @@ RB_METHOD(viewportInitialize)
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
v->initDynAttribs();
|
v->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(self, v->getRect(), "rect", RectType);
|
wrapProperty(self, &v->getRect(), "rect", RectType);
|
||||||
wrapProperty(self, v->getColor(), "color", ColorType);
|
wrapProperty(self, &v->getColor(), "color", ColorType);
|
||||||
wrapProperty(self, v->getTone(), "tone", ToneType);
|
wrapProperty(self, &v->getTone(), "tone", ToneType);
|
||||||
|
|
||||||
/* 'elements' holds all SceneElements that become children
|
/* 'elements' holds all SceneElements that become children
|
||||||
* of this viewport, so we can dispose them when the viewport
|
* of this viewport, so we can dispose them when the viewport
|
||||||
|
|
|
@ -34,7 +34,7 @@ RB_METHOD(windowInitialize)
|
||||||
|
|
||||||
w->initDynAttribs();
|
w->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(self, w->getCursorRect(), "cursor_rect", RectType);
|
wrapProperty(self, &w->getCursorRect(), "cursor_rect", RectType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,10 @@ RB_METHOD(windowVXInitialize)
|
||||||
|
|
||||||
w->initDynAttribs();
|
w->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(self, w->getCursorRect(), "cursor_rect", RectType);
|
wrapProperty(self, &w->getCursorRect(), "cursor_rect", RectType);
|
||||||
|
|
||||||
if (rgssVer >= 3)
|
if (rgssVer >= 3)
|
||||||
wrapProperty(self, w->getTone(), "tone", ToneType);
|
wrapProperty(self, &w->getTone(), "tone", ToneType);
|
||||||
|
|
||||||
Bitmap *contents = new Bitmap(1, 1);
|
Bitmap *contents = new Bitmap(1, 1);
|
||||||
VALUE contentsObj = wrapObject(contents, BitmapType);
|
VALUE contentsObj = wrapObject(contents, BitmapType);
|
||||||
|
|
|
@ -166,7 +166,7 @@ defineClass(mrb_state *mrb, const char *name)
|
||||||
PropKlass *prop; \
|
PropKlass *prop; \
|
||||||
mrb_get_args(mrb, "o", &propObj); \
|
mrb_get_args(mrb, "o", &propObj); \
|
||||||
prop = getPrivateDataCheck<PropKlass>(mrb, propObj, PropKlass##Type); \
|
prop = getPrivateDataCheck<PropKlass>(mrb, propObj, PropKlass##Type); \
|
||||||
GUARD_EXC( k->set##PropName(prop); ) \
|
GUARD_EXC( k->set##PropName(*prop); ) \
|
||||||
return propObj; \
|
return propObj; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,10 @@ MRB_METHOD(bitmapInitialize)
|
||||||
|
|
||||||
mrb_value fontProp = wrapProperty(mrb, self, font, CSfont, FontType);
|
mrb_value fontProp = wrapProperty(mrb, self, font, CSfont, FontType);
|
||||||
|
|
||||||
wrapProperty(mrb, fontProp, font->getColor(), CScolor, ColorType);
|
wrapProperty(mrb, fontProp, &font->getColor(), CScolor, ColorType);
|
||||||
|
|
||||||
if (rgssVer >= 3)
|
if (rgssVer >= 3)
|
||||||
wrapProperty(mrb, fontProp, font->getOutColor(), CSout_color, ColorType);
|
wrapProperty(mrb, fontProp, &font->getOutColor(), CSout_color, ColorType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ MRB_METHOD(bitmapSetFont)
|
||||||
|
|
||||||
font = getPrivateDataCheck<Font>(mrb, fontObj, FontType);
|
font = getPrivateDataCheck<Font>(mrb, fontObj, FontType);
|
||||||
|
|
||||||
GUARD_EXC( b->setFont(font); )
|
GUARD_EXC( b->setFont(*font); )
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,10 @@ MRB_METHOD(fontInitialize)
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
f->initDynAttribs();
|
f->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(mrb, self, f->getColor(), CScolor, ColorType);
|
wrapProperty(mrb, self, &f->getColor(), CScolor, ColorType);
|
||||||
|
|
||||||
if (rgssVer >= 3)
|
if (rgssVer >= 3)
|
||||||
wrapProperty(mrb, self, f->getOutColor(), CSout_color, ColorType);
|
wrapProperty(mrb, self, &f->getOutColor(), CSout_color, ColorType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -76,10 +76,10 @@ MRB_METHOD(fontInitializeCopy)
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
f->initDynAttribs();
|
f->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(mrb, self, f->getColor(), CScolor, ColorType);
|
wrapProperty(mrb, self, &f->getColor(), CScolor, ColorType);
|
||||||
|
|
||||||
if (rgssVer >= 3)
|
if (rgssVer >= 3)
|
||||||
wrapProperty(mrb, self, f->getOutColor(), CSout_color, ColorType);
|
wrapProperty(mrb, self, &f->getOutColor(), CSout_color, ColorType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ MRB_METHOD(FontSetDefaultColor)
|
||||||
|
|
||||||
Color *c = getPrivateDataCheck<Color>(mrb, colorObj, ColorType);
|
Color *c = getPrivateDataCheck<Color>(mrb, colorObj, ColorType);
|
||||||
|
|
||||||
Font::setDefaultColor(c);
|
Font::setDefaultColor(*c);
|
||||||
|
|
||||||
return colorObj;
|
return colorObj;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ MRB_METHOD(FontSetDefaultOutColor)
|
||||||
|
|
||||||
Color *c = getPrivateDataCheck<Color>(mrb, colorObj, ColorType);
|
Color *c = getPrivateDataCheck<Color>(mrb, colorObj, ColorType);
|
||||||
|
|
||||||
Font::setDefaultOutColor(c);
|
Font::setDefaultOutColor(*c);
|
||||||
|
|
||||||
return colorObj;
|
return colorObj;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ fontBindingInit(mrb_state *mrb)
|
||||||
RClass *klass = defineClass(mrb, "Font");
|
RClass *klass = defineClass(mrb, "Font");
|
||||||
|
|
||||||
Font::initDefaultDynAttribs();
|
Font::initDefaultDynAttribs();
|
||||||
wrapProperty(mrb, mrb_obj_value(klass), Font::getDefaultColor(), CSdefault_color, ColorType);
|
wrapProperty(mrb, mrb_obj_value(klass), &Font::getDefaultColor(), CSdefault_color, ColorType);
|
||||||
|
|
||||||
mrb_define_class_method(mrb, klass, "exist?", fontDoesExist, MRB_ARGS_REQ(1));
|
mrb_define_class_method(mrb, klass, "exist?", fontDoesExist, MRB_ARGS_REQ(1));
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ fontBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultOutline, "default_outline");
|
INIT_KLASS_PROP_BIND(Font, DefaultOutline, "default_outline");
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultOutColor, "default_out_color");
|
INIT_KLASS_PROP_BIND(Font, DefaultOutColor, "default_out_color");
|
||||||
wrapProperty(mrb, mrb_obj_value(klass), Font::getDefaultOutColor(), CSdefault_out_color, ColorType);
|
wrapProperty(mrb, mrb_obj_value(klass), &Font::getDefaultOutColor(), CSdefault_out_color, ColorType);
|
||||||
}
|
}
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "initialize", fontInitialize, MRB_ARGS_OPT(2));
|
mrb_define_method(mrb, klass, "initialize", fontInitialize, MRB_ARGS_OPT(2));
|
||||||
|
|
|
@ -35,8 +35,8 @@ MRB_METHOD(planeInitialize)
|
||||||
|
|
||||||
p->initDynAttribs();
|
p->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(mrb, self, p->getColor(), CScolor, ColorType);
|
wrapProperty(mrb, self, &p->getColor(), CScolor, ColorType);
|
||||||
wrapProperty(mrb, self, p->getTone(), CStone, ToneType);
|
wrapProperty(mrb, self, &p->getTone(), CStone, ToneType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ MRB_METHOD(spriteInitialize)
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
s->initDynAttribs();
|
s->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(mrb, self, s->getSrcRect(), CSsrc_rect, RectType);
|
wrapProperty(mrb, self, &s->getSrcRect(), CSsrc_rect, RectType);
|
||||||
wrapProperty(mrb, self, s->getColor(), CScolor, ColorType);
|
wrapProperty(mrb, self, &s->getColor(), CScolor, ColorType);
|
||||||
wrapProperty(mrb, self, s->getTone(), CStone, ToneType);
|
wrapProperty(mrb, self, &s->getTone(), CStone, ToneType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,9 @@ MRB_METHOD(viewportInitialize)
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
v->initDynAttribs();
|
v->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(mrb, self, v->getRect(), CSrect, RectType);
|
wrapProperty(mrb, self, &v->getRect(), CSrect, RectType);
|
||||||
wrapProperty(mrb, self, v->getColor(), CScolor, ColorType);
|
wrapProperty(mrb, self, &v->getColor(), CScolor, ColorType);
|
||||||
wrapProperty(mrb, self, v->getTone(), CStone, ToneType);
|
wrapProperty(mrb, self, &v->getTone(), CStone, ToneType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ MRB_METHOD(windowInitialize)
|
||||||
setPrivateData(self, w, WindowType);
|
setPrivateData(self, w, WindowType);
|
||||||
|
|
||||||
w->initDynAttribs();
|
w->initDynAttribs();
|
||||||
wrapProperty(mrb, self, w->getCursorRect(), CScursor_rect, RectType);
|
wrapProperty(mrb, self, &w->getCursorRect(), CScursor_rect, RectType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -941,12 +941,12 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TTF_Font *font = p->font->getSdlFont();
|
TTF_Font *font = p->font->getSdlFont();
|
||||||
Color *fontColor = p->font->getColor();
|
const Color &fontColor = p->font->getColor();
|
||||||
|
|
||||||
SDL_Color c;
|
SDL_Color c;
|
||||||
fontColor->toSDLColor(c);
|
fontColor.toSDLColor(c);
|
||||||
|
|
||||||
float txtAlpha = fontColor->norm.w;
|
float txtAlpha = fontColor.norm.w;
|
||||||
|
|
||||||
SDL_Surface *txtSurf;
|
SDL_Surface *txtSurf;
|
||||||
|
|
||||||
|
@ -1186,11 +1186,11 @@ IntRect Bitmap::textSize(const char *str)
|
||||||
return IntRect(0, 0, w, h);
|
return IntRect(0, 0, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_ATTR_RD_SIMPLE(Bitmap, Font, Font*, p->font)
|
DEF_ATTR_RD_SIMPLE(Bitmap, Font, Font&, *p->font)
|
||||||
|
|
||||||
void Bitmap::setFont(Font *value)
|
void Bitmap::setFont(Font &value)
|
||||||
{
|
{
|
||||||
*p->font = *value;
|
*p->font = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bitmap::setInitFont(Font *value)
|
void Bitmap::setInitFont(Font *value)
|
||||||
|
|
|
@ -99,7 +99,7 @@ public:
|
||||||
|
|
||||||
IntRect textSize(const char *str);
|
IntRect textSize(const char *str);
|
||||||
|
|
||||||
DECL_ATTR(Font, Font*)
|
DECL_ATTR(Font, Font&)
|
||||||
|
|
||||||
/* Sets initial reference without copying by value,
|
/* Sets initial reference without copying by value,
|
||||||
* use at construction */
|
* use at construction */
|
||||||
|
|
27
src/font.cpp
27
src/font.cpp
|
@ -351,20 +351,21 @@ void Font::setSize(int value)
|
||||||
static void guardDisposed() {}
|
static void guardDisposed() {}
|
||||||
|
|
||||||
DEF_ATTR_RD_SIMPLE(Font, Size, int, p->size)
|
DEF_ATTR_RD_SIMPLE(Font, Size, int, p->size)
|
||||||
DEF_ATTR_SIMPLE (Font, Bold, bool, p->bold)
|
|
||||||
DEF_ATTR_SIMPLE (Font, Italic, bool, p->italic)
|
|
||||||
DEF_ATTR_SIMPLE (Font, Shadow, bool, p->shadow)
|
|
||||||
DEF_ATTR_SIMPLE (Font, Outline, bool, p->outline)
|
|
||||||
DEF_ATTR_OBJ_VALUE(Font, Color, Color*, p->color)
|
|
||||||
DEF_ATTR_OBJ_VALUE(Font, OutColor, Color*, p->outColor)
|
|
||||||
|
|
||||||
DEF_ATTR_SIMPLE_STATIC (Font, DefaultSize, int, FontPrivate::defaultSize)
|
DEF_ATTR_SIMPLE(Font, Bold, bool, p->bold)
|
||||||
DEF_ATTR_SIMPLE_STATIC (Font, DefaultBold, bool, FontPrivate::defaultBold)
|
DEF_ATTR_SIMPLE(Font, Italic, bool, p->italic)
|
||||||
DEF_ATTR_SIMPLE_STATIC (Font, DefaultItalic, bool, FontPrivate::defaultItalic)
|
DEF_ATTR_SIMPLE(Font, Shadow, bool, p->shadow)
|
||||||
DEF_ATTR_SIMPLE_STATIC (Font, DefaultShadow, bool, FontPrivate::defaultShadow)
|
DEF_ATTR_SIMPLE(Font, Outline, bool, p->outline)
|
||||||
DEF_ATTR_SIMPLE_STATIC (Font, DefaultOutline, bool, FontPrivate::defaultOutline)
|
DEF_ATTR_SIMPLE(Font, Color, Color&, *p->color)
|
||||||
DEF_ATTR_OBJ_VALUE_STATIC(Font, DefaultColor, Color*, FontPrivate::defaultColor)
|
DEF_ATTR_SIMPLE(Font, OutColor, Color&, *p->outColor)
|
||||||
DEF_ATTR_OBJ_VALUE_STATIC(Font, DefaultOutColor, Color*, FontPrivate::defaultOutColor)
|
|
||||||
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultSize, int, FontPrivate::defaultSize)
|
||||||
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultBold, bool, FontPrivate::defaultBold)
|
||||||
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultItalic, bool, FontPrivate::defaultItalic)
|
||||||
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultShadow, bool, FontPrivate::defaultShadow)
|
||||||
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultOutline, bool, FontPrivate::defaultOutline)
|
||||||
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultColor, Color&, *FontPrivate::defaultColor)
|
||||||
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultOutColor, Color&, *FontPrivate::defaultOutColor)
|
||||||
|
|
||||||
const char *Font::getDefaultName()
|
const char *Font::getDefaultName()
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,19 +92,19 @@ public:
|
||||||
DECL_ATTR( Size, int )
|
DECL_ATTR( Size, int )
|
||||||
DECL_ATTR( Bold, bool )
|
DECL_ATTR( Bold, bool )
|
||||||
DECL_ATTR( Italic, bool )
|
DECL_ATTR( Italic, bool )
|
||||||
DECL_ATTR( Color, Color* )
|
DECL_ATTR( Color, Color& )
|
||||||
DECL_ATTR( Shadow, bool )
|
DECL_ATTR( Shadow, bool )
|
||||||
DECL_ATTR( Outline, bool )
|
DECL_ATTR( Outline, bool )
|
||||||
DECL_ATTR( OutColor, Color* )
|
DECL_ATTR( OutColor, Color& )
|
||||||
|
|
||||||
DECL_ATTR_STATIC( DefaultName, const char* )
|
DECL_ATTR_STATIC( DefaultName, const char* )
|
||||||
DECL_ATTR_STATIC( DefaultSize, int )
|
DECL_ATTR_STATIC( DefaultSize, int )
|
||||||
DECL_ATTR_STATIC( DefaultBold, bool )
|
DECL_ATTR_STATIC( DefaultBold, bool )
|
||||||
DECL_ATTR_STATIC( DefaultItalic, bool )
|
DECL_ATTR_STATIC( DefaultItalic, bool )
|
||||||
DECL_ATTR_STATIC( DefaultColor, Color* )
|
DECL_ATTR_STATIC( DefaultColor, Color& )
|
||||||
DECL_ATTR_STATIC( DefaultShadow, bool )
|
DECL_ATTR_STATIC( DefaultShadow, bool )
|
||||||
DECL_ATTR_STATIC( DefaultOutline, bool )
|
DECL_ATTR_STATIC( DefaultOutline, bool )
|
||||||
DECL_ATTR_STATIC( DefaultOutColor, Color* )
|
DECL_ATTR_STATIC( DefaultOutColor, Color& )
|
||||||
|
|
||||||
/* Assigns heap allocated objects to object properties;
|
/* Assigns heap allocated objects to object properties;
|
||||||
* using this in pure C++ will cause memory leaks
|
* using this in pure C++ will cause memory leaks
|
||||||
|
|
|
@ -161,9 +161,9 @@ DEF_ATTR_RD_SIMPLE(Plane, ZoomX, float, p->zoomX)
|
||||||
DEF_ATTR_RD_SIMPLE(Plane, ZoomY, float, p->zoomY)
|
DEF_ATTR_RD_SIMPLE(Plane, ZoomY, float, p->zoomY)
|
||||||
DEF_ATTR_RD_SIMPLE(Plane, BlendType, int, p->blendType)
|
DEF_ATTR_RD_SIMPLE(Plane, BlendType, int, p->blendType)
|
||||||
|
|
||||||
DEF_ATTR_SIMPLE (Plane, Opacity, int, p->opacity)
|
DEF_ATTR_SIMPLE(Plane, Opacity, int, p->opacity)
|
||||||
DEF_ATTR_OBJ_VALUE(Plane, Color, Color*, p->color)
|
DEF_ATTR_SIMPLE(Plane, Color, Color&, *p->color)
|
||||||
DEF_ATTR_OBJ_VALUE(Plane, Tone, Tone*, p->tone)
|
DEF_ATTR_SIMPLE(Plane, Tone, Tone&, *p->tone)
|
||||||
|
|
||||||
Plane::~Plane()
|
Plane::~Plane()
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,8 +44,8 @@ public:
|
||||||
DECL_ATTR( ZoomY, float )
|
DECL_ATTR( ZoomY, float )
|
||||||
DECL_ATTR( Opacity, int )
|
DECL_ATTR( Opacity, int )
|
||||||
DECL_ATTR( BlendType, int )
|
DECL_ATTR( BlendType, int )
|
||||||
DECL_ATTR( Color, Color* )
|
DECL_ATTR( Color, Color& )
|
||||||
DECL_ATTR( Tone, Tone* )
|
DECL_ATTR( Tone, Tone& )
|
||||||
|
|
||||||
void initDynAttribs();
|
void initDynAttribs();
|
||||||
|
|
||||||
|
|
|
@ -317,12 +317,11 @@ DEF_ATTR_RD_SIMPLE(Sprite, WaveLength, int, p->wave.length)
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, WaveSpeed, int, p->wave.speed)
|
DEF_ATTR_RD_SIMPLE(Sprite, WaveSpeed, int, p->wave.speed)
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, WavePhase, float, p->wave.phase)
|
DEF_ATTR_RD_SIMPLE(Sprite, WavePhase, float, p->wave.phase)
|
||||||
|
|
||||||
DEF_ATTR_SIMPLE (Sprite, BushOpacity, int, p->bushOpacity)
|
DEF_ATTR_SIMPLE(Sprite, BushOpacity, int, p->bushOpacity)
|
||||||
DEF_ATTR_SIMPLE (Sprite, Opacity, int, p->opacity)
|
DEF_ATTR_SIMPLE(Sprite, Opacity, int, p->opacity)
|
||||||
|
DEF_ATTR_SIMPLE(Sprite, SrcRect, Rect&, *p->srcRect)
|
||||||
DEF_ATTR_OBJ_VALUE(Sprite, SrcRect, Rect*, p->srcRect)
|
DEF_ATTR_SIMPLE(Sprite, Color, Color&, *p->color)
|
||||||
DEF_ATTR_OBJ_VALUE(Sprite, Color, Color*, p->color)
|
DEF_ATTR_SIMPLE(Sprite, Tone, Tone&, *p->tone)
|
||||||
DEF_ATTR_OBJ_VALUE(Sprite, Tone, Tone*, p->tone)
|
|
||||||
|
|
||||||
void Sprite::setBitmap(Bitmap *bitmap)
|
void Sprite::setBitmap(Bitmap *bitmap)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
DECL_ATTR( Bitmap, Bitmap* )
|
DECL_ATTR( Bitmap, Bitmap* )
|
||||||
DECL_ATTR( SrcRect, Rect* )
|
DECL_ATTR( SrcRect, Rect& )
|
||||||
DECL_ATTR( X, int )
|
DECL_ATTR( X, int )
|
||||||
DECL_ATTR( Y, int )
|
DECL_ATTR( Y, int )
|
||||||
DECL_ATTR( OX, int )
|
DECL_ATTR( OX, int )
|
||||||
|
@ -60,8 +60,8 @@ public:
|
||||||
DECL_ATTR( BushOpacity, int )
|
DECL_ATTR( BushOpacity, int )
|
||||||
DECL_ATTR( Opacity, int )
|
DECL_ATTR( Opacity, int )
|
||||||
DECL_ATTR( BlendType, int )
|
DECL_ATTR( BlendType, int )
|
||||||
DECL_ATTR( Color, Color* )
|
DECL_ATTR( Color, Color& )
|
||||||
DECL_ATTR( Tone, Tone* )
|
DECL_ATTR( Tone, Tone& )
|
||||||
DECL_ATTR( WaveAmp, int )
|
DECL_ATTR( WaveAmp, int )
|
||||||
DECL_ATTR( WaveLength, int )
|
DECL_ATTR( WaveLength, int )
|
||||||
DECL_ATTR( WaveSpeed, int )
|
DECL_ATTR( WaveSpeed, int )
|
||||||
|
|
16
src/util.h
16
src/util.h
|
@ -152,20 +152,4 @@ inline C *dataPtr(std::vector<C> &v)
|
||||||
#define DEF_ATTR_SIMPLE_STATIC(klass, name, type, location) \
|
#define DEF_ATTR_SIMPLE_STATIC(klass, name, type, location) \
|
||||||
DEF_ATTR_SIMPLE_DETAILED(klass, name, type, location, )
|
DEF_ATTR_SIMPLE_DETAILED(klass, name, type, location, )
|
||||||
|
|
||||||
#define DEF_ATTR_OBJ_VALUE(klass, name, type, location) \
|
|
||||||
DEF_ATTR_RD_SIMPLE_DETAILED(klass, name, type, location, const) \
|
|
||||||
void klass :: set##name(type value) \
|
|
||||||
{ \
|
|
||||||
guardDisposed(); \
|
|
||||||
*location = *value; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DEF_ATTR_OBJ_VALUE_STATIC(klass, name, type, location) \
|
|
||||||
DEF_ATTR_RD_SIMPLE_DETAILED(klass, name, type, location, ) \
|
|
||||||
void klass :: set##name(type value) \
|
|
||||||
{ \
|
|
||||||
guardDisposed(); \
|
|
||||||
*location = *value; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // UTIL_H
|
#endif // UTIL_H
|
||||||
|
|
|
@ -147,9 +147,9 @@ void Viewport::update()
|
||||||
DEF_ATTR_RD_SIMPLE(Viewport, OX, int, geometry.xOrigin)
|
DEF_ATTR_RD_SIMPLE(Viewport, OX, int, geometry.xOrigin)
|
||||||
DEF_ATTR_RD_SIMPLE(Viewport, OY, int, geometry.yOrigin)
|
DEF_ATTR_RD_SIMPLE(Viewport, OY, int, geometry.yOrigin)
|
||||||
|
|
||||||
DEF_ATTR_OBJ_VALUE(Viewport, Rect, Rect*, p->rect)
|
DEF_ATTR_SIMPLE(Viewport, Rect, Rect&, *p->rect)
|
||||||
DEF_ATTR_OBJ_VALUE(Viewport, Color, Color*, p->color)
|
DEF_ATTR_SIMPLE(Viewport, Color, Color&, *p->color)
|
||||||
DEF_ATTR_OBJ_VALUE(Viewport, Tone, Tone*, p->tone)
|
DEF_ATTR_SIMPLE(Viewport, Tone, Tone&, *p->tone)
|
||||||
|
|
||||||
void Viewport::setOX(int value)
|
void Viewport::setOX(int value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,11 +39,11 @@ public:
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
DECL_ATTR( Rect, Rect* )
|
DECL_ATTR( Rect, Rect& )
|
||||||
DECL_ATTR( OX, int )
|
DECL_ATTR( OX, int )
|
||||||
DECL_ATTR( OY, int )
|
DECL_ATTR( OY, int )
|
||||||
DECL_ATTR( Color, Color* )
|
DECL_ATTR( Color, Color& )
|
||||||
DECL_ATTR( Tone, Tone* )
|
DECL_ATTR( Tone, Tone& )
|
||||||
|
|
||||||
void initDynAttribs();
|
void initDynAttribs();
|
||||||
|
|
||||||
|
|
|
@ -706,6 +706,7 @@ void Window::update()
|
||||||
|
|
||||||
DEF_ATTR_SIMPLE(Window, X, int, p->position.x)
|
DEF_ATTR_SIMPLE(Window, X, int, p->position.x)
|
||||||
DEF_ATTR_SIMPLE(Window, Y, int, p->position.y)
|
DEF_ATTR_SIMPLE(Window, Y, int, p->position.y)
|
||||||
|
DEF_ATTR_SIMPLE(Window, CursorRect, Rect&, *p->cursorRect)
|
||||||
|
|
||||||
DEF_ATTR_RD_SIMPLE(Window, Windowskin, Bitmap*, p->windowskin)
|
DEF_ATTR_RD_SIMPLE(Window, Windowskin, Bitmap*, p->windowskin)
|
||||||
DEF_ATTR_RD_SIMPLE(Window, Contents, Bitmap*, p->contents)
|
DEF_ATTR_RD_SIMPLE(Window, Contents, Bitmap*, p->contents)
|
||||||
|
@ -720,8 +721,6 @@ DEF_ATTR_RD_SIMPLE(Window, Opacity, int, p->opacity)
|
||||||
DEF_ATTR_RD_SIMPLE(Window, BackOpacity, int, p->backOpacity)
|
DEF_ATTR_RD_SIMPLE(Window, BackOpacity, int, p->backOpacity)
|
||||||
DEF_ATTR_RD_SIMPLE(Window, ContentsOpacity, int, p->contentsOpacity)
|
DEF_ATTR_RD_SIMPLE(Window, ContentsOpacity, int, p->contentsOpacity)
|
||||||
|
|
||||||
DEF_ATTR_OBJ_VALUE(Window, CursorRect, Rect*, p->cursorRect)
|
|
||||||
|
|
||||||
void Window::setWindowskin(Bitmap *value)
|
void Window::setWindowskin(Bitmap *value)
|
||||||
{
|
{
|
||||||
guardDisposed();
|
guardDisposed();
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
DECL_ATTR( Windowskin, Bitmap* )
|
DECL_ATTR( Windowskin, Bitmap* )
|
||||||
DECL_ATTR( Contents, Bitmap* )
|
DECL_ATTR( Contents, Bitmap* )
|
||||||
DECL_ATTR( Stretch, bool )
|
DECL_ATTR( Stretch, bool )
|
||||||
DECL_ATTR( CursorRect, Rect* )
|
DECL_ATTR( CursorRect, Rect& )
|
||||||
DECL_ATTR( Active, bool )
|
DECL_ATTR( Active, bool )
|
||||||
DECL_ATTR( Pause, bool )
|
DECL_ATTR( Pause, bool )
|
||||||
DECL_ATTR( X, int )
|
DECL_ATTR( X, int )
|
||||||
|
|
|
@ -882,6 +882,8 @@ bool WindowVX::isClosed() const
|
||||||
|
|
||||||
DEF_ATTR_SIMPLE(WindowVX, X, int, p->geo.x)
|
DEF_ATTR_SIMPLE(WindowVX, X, int, p->geo.x)
|
||||||
DEF_ATTR_SIMPLE(WindowVX, Y, int, p->geo.y)
|
DEF_ATTR_SIMPLE(WindowVX, Y, int, p->geo.y)
|
||||||
|
DEF_ATTR_SIMPLE(WindowVX, CursorRect, Rect&, *p->cursorRect)
|
||||||
|
DEF_ATTR_SIMPLE(WindowVX, Tone, Tone&, *p->tone)
|
||||||
|
|
||||||
DEF_ATTR_RD_SIMPLE(WindowVX, Windowskin, Bitmap*, p->windowskin)
|
DEF_ATTR_RD_SIMPLE(WindowVX, Windowskin, Bitmap*, p->windowskin)
|
||||||
DEF_ATTR_RD_SIMPLE(WindowVX, Contents, Bitmap*, p->contents)
|
DEF_ATTR_RD_SIMPLE(WindowVX, Contents, Bitmap*, p->contents)
|
||||||
|
@ -899,9 +901,6 @@ DEF_ATTR_RD_SIMPLE(WindowVX, BackOpacity, int, p->backOpacity)
|
||||||
DEF_ATTR_RD_SIMPLE(WindowVX, ContentsOpacity, int, p->contentsOpacity)
|
DEF_ATTR_RD_SIMPLE(WindowVX, ContentsOpacity, int, p->contentsOpacity)
|
||||||
DEF_ATTR_RD_SIMPLE(WindowVX, Openness, int, p->openness)
|
DEF_ATTR_RD_SIMPLE(WindowVX, Openness, int, p->openness)
|
||||||
|
|
||||||
DEF_ATTR_OBJ_VALUE(WindowVX, CursorRect, Rect*, p->cursorRect)
|
|
||||||
DEF_ATTR_OBJ_VALUE(WindowVX, Tone, Tone*, p->tone)
|
|
||||||
|
|
||||||
void WindowVX::setWindowskin(Bitmap *value)
|
void WindowVX::setWindowskin(Bitmap *value)
|
||||||
{
|
{
|
||||||
guardDisposed();
|
guardDisposed();
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
|
|
||||||
DECL_ATTR( Windowskin, Bitmap* )
|
DECL_ATTR( Windowskin, Bitmap* )
|
||||||
DECL_ATTR( Contents, Bitmap* )
|
DECL_ATTR( Contents, Bitmap* )
|
||||||
DECL_ATTR( CursorRect, Rect* )
|
DECL_ATTR( CursorRect, Rect& )
|
||||||
DECL_ATTR( Active, bool )
|
DECL_ATTR( Active, bool )
|
||||||
DECL_ATTR( ArrowsVisible, bool )
|
DECL_ATTR( ArrowsVisible, bool )
|
||||||
DECL_ATTR( Pause, bool )
|
DECL_ATTR( Pause, bool )
|
||||||
|
@ -64,7 +64,7 @@ public:
|
||||||
DECL_ATTR( BackOpacity, int )
|
DECL_ATTR( BackOpacity, int )
|
||||||
DECL_ATTR( ContentsOpacity, int )
|
DECL_ATTR( ContentsOpacity, int )
|
||||||
DECL_ATTR( Openness, int )
|
DECL_ATTR( Openness, int )
|
||||||
DECL_ATTR( Tone, Tone* )
|
DECL_ATTR( Tone, Tone& )
|
||||||
|
|
||||||
void initDynAttribs();
|
void initDynAttribs();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue