| Class | Joyau::Message |
| In: |
Drawable.cpp
|
| Parent: | Joyau::Drawable |
Class used when drawing message in message boxes. You can set backgrounds, images, fonts, … on them.
Returns the message’s background’s color.
/*
Returns the message's background's color.
*/
VALUE Message_bgColor(VALUE self)
{
Message &ref = getRef<Message>(self);
return col2hash(ref.getBgColor());
}
Returns the message’s border’s color.
/*
Returns the message's border's color.
*/
VALUE Message_borderColor(VALUE self)
{
Message &ref = getRef<Message>(self);
return col2hash(ref.getBorderColor());
}
Sets the message’s height.
/*
call-seq: h=(val)
Sets the message's height.
*/
VALUE Message_setH(VALUE self, VALUE h)
{
Message &ref = getRef<Message>(self);
ref.setH(FIX2INT(h));
return h;
}
Resizes the messages.
/*
call-seq: resize(w, h)
Resizes the messages.
*/
VALUE Message_resize(VALUE self, VALUE w, VALUE h)
{
Message &ref = getRef<Message>(self);
int _w = FIX2INT(w);
int _h = FIX2INT(h);
ref.resize(_w, _h);
return Qnil;
}
Sets the image drawn under the message (the argument is a Sprite).
/*
call-seq: setBackground(pic)
Sets the image drawn under the message (the argument is a Sprite).
*/
VALUE Message_setBackground(VALUE self, VALUE pic)
{
if (!rb_obj_is_kind_of(pic, getClass("Sprite")))
rb_raise(rb_eTypeError, "Can't convert %s into Joyau::Sprite",
rb_obj_classname(pic));
Message &ref = getRef<Message>(self);
Sprite *spr = getPtr<Sprite>(pic);
ref.setBackground(spr);
return pic;
}
Sets the message’s background’s color.
/*
call-seq: setBgColor(col)
Sets the message's background's color.
*/
VALUE Message_setBgColor(VALUE self, VALUE col)
{
Message &ref = getRef<Message>(self);
OSL_COLOR color = hash2col(col);
ref.setBgColor(color);
return col;
}
Sets the message’s border’s color.
/*
call-seq: setBorderColor(col)
Sets the message's border's color.
*/
VALUE Message_setBorderColor(VALUE self, VALUE col)
{
Message &ref = getRef<Message>(self);
OSL_COLOR color = hash2col(col);
ref.setBorderColor(color);
return col;
}
Sets the image drawn beside the message (the argument is a Sprite).
/*
call-seq: setImage(pic)
Sets the image drawn beside the message (the argument is a Sprite).
*/
VALUE Message_setImage(VALUE self, VALUE pic)
{
if (!rb_obj_is_kind_of(pic, getClass("Sprite")))
rb_raise(rb_eTypeError, "Can't convert %s into Joyau::Sprite",
rb_obj_classname(pic));
Message &ref = getRef<Message>(self);
Sprite *spr = getPtr<Sprite>(pic);
ref.setImage(spr);
return pic;
}
Sets the message’s text.
/*
call-seq: setText(txt)
Sets the message's text.
*/
VALUE Message_setText(VALUE self, VALUE txt)
{
txt = rb_obj_as_string(txt);
Message &ref = getRef<Message>(self);
std::string str = StringValuePtr(txt);
ref.setText(str);
return txt;
}
Sets the message’s text’s color.
/*
call-seq: setTextColor(col)
Sets the message's text's color.
*/
VALUE Message_setTextColor(VALUE self, VALUE col)
{
Message &ref = getRef<Message>(self);
OSL_COLOR color = hash2col(col);
ref.setTextColor(color);
return col;
}
Sets the message’s text’s font.
/*
call-seq: setTextFont(col)
Sets the message's text's font.
*/
VALUE Message_setTextFont(VALUE self, VALUE f)
{
Message &ref = getRef<Message>(self);
std::string str = StringValuePtr(f);
ref.setTextFont(str);
return f;
}
Sets the message’s title.
/*
call-seq: setTitle(txt)
Sets the message's title.
*/
VALUE Message_setTitle(VALUE self, VALUE txt)
{
txt = rb_obj_as_string(txt);
Message &ref = getRef<Message>(self);
std::string str = StringValuePtr(txt);
ref.setTitle(str);
return txt;
}
Sets the message’s title’s color.
/*
call-seq: setTitleColor(col)
Sets the message's title's color.
*/
VALUE Message_setTitleColor(VALUE self, VALUE col)
{
Message &ref = getRef<Message>(self);
OSL_COLOR color = hash2col(col);
ref.setTitleColor(color);
return col;
}
Sets the message’s title’s font.
/*
call-seq: setTitleFont(col)
Sets the message's title's font.
*/
VALUE Message_setTitleFont(VALUE self, VALUE f)
{
Message &ref = getRef<Message>(self);
std::string str = StringValuePtr(f);
ref.setTitleFont(str);
return f;
}
Sets the message’s title’s position.
/*
call-seq: setTitlePos(x, y)
Sets the message's title's position.
*/
VALUE Message_setTitlePos(VALUE self, VALUE x, VALUE y)
{
Message &ref = getRef<Message>(self);
int _x = FIX2INT(x);
int _y = FIX2INT(y);
ref.setTitlePos(_x, _y);
return Qnil;
}
Returns the message’s text.
/*
Returns the message's text.
*/
VALUE Message_text(VALUE self)
{
Message &ref = getRef<Message>(self);
return rb_str_new2(ref.getText().c_str());
}
Returns the message’s text’s color.
/*
Returns the message's text's color.
*/
VALUE Message_textColor(VALUE self)
{
Message &ref = getRef<Message>(self);
return col2hash(ref.getTextColor());
}
Returns the message’s text’s font.
/*
Returns the message's text's font.
*/
VALUE Message_textFont(VALUE self)
{
Message &ref = getRef<Message>(self);
return rb_str_new2(ref.getTextFont().c_str());
}
Returns the message’s title.
/*
Returns the message's title.
*/
VALUE Message_title(VALUE self)
{
Message &ref = getRef<Message>(self);
return rb_str_new2(ref.getTitle().c_str());
}
Returns the message’s title’s color.
/*
Returns the message's title's color.
*/
VALUE Message_titleColor(VALUE self)
{
Message &ref = getRef<Message>(self);
return col2hash(ref.getTitleColor());
}
Returns the message’s title’s font.
/*
Returns the message's title's font.
*/
VALUE Message_titleFont(VALUE self)
{
Message &ref = getRef<Message>(self);
return rb_str_new2(ref.getTitleFont().c_str());
}
Returns the message’s title’s position.
/*
Returns the message's title's position.
*/
VALUE Message_titlePos(VALUE self)
{
Message &ref = getRef<Message>(self);
Point p = ref.getTitlePos();
return createObject(getClass("Point"), p);
}