| Class | Joyau::DrawableText |
| In: |
Drawable.cpp
|
| Parent: | Joyau::Shape |
Class used when drawing text, using either a built-in or an OFT font.
Returns the text’s background.
/*
Returns the text's background.
*/
VALUE DrawableText_background(VALUE self)
{
DrawableText &ref = getRef<DrawableText>(self);
return col2hash(ref.getBackground());
}
Returns the text’s font name.
/*
Returns the text's font name.
*/
VALUE DrawableText_font(VALUE self)
{
DrawableText &ref = getRef<DrawableText>(self);
return rb_str_new2(ref.getFont().c_str());
}
Returns the scripted state.
/*
Returns the scripted state.
*/
VALUE DrawableText_scripted(VALUE self)
{
DrawableText &ref = getRef<DrawableText>(self);
return ref.isScripted() ? Qtrue : Qfalse;
}
Sets the text’s background.
/*
call-seq: setBackground(color)
background=(color)
Sets the text's background.
*/
VALUE DrawableText_setBackground(VALUE self, VALUE color)
{
DrawableText &ref = getRef<DrawableText>(self);
OSL_COLOR col = hash2col(color);
ref.setBackground(col);
return color;
}
Loads an OFT. “” can be given to remove the actual font.
/*
call-seq: setFont(font)
font=(font)
Loads an OFT. "" can be given to remove the actual font.
*/
VALUE DrawableText_setFont(VALUE self, VALUE font)
{
DrawableText &ref = getRef<DrawableText>(self);
std::string str = StringValuePtr(font);
ref.setFont(str);
return font;
}
Sets a drawable’s text.
/*
call-seq: setText(str)
text=(str)
Sets a drawable's text.
*/
VALUE DrawableText_setText(VALUE self, VALUE text)
{
text = rb_obj_as_string(text);
DrawableText &ref = getRef<DrawableText>(self);
std::string txt = StringValuePtr(text);
ref.setText(txt);
return text;
}
Returns the stirring state.
/*
Returns the stirring state.
*/
VALUE DrawableText_stirring(VALUE self)
{
DrawableText &ref = getRef<DrawableText>(self);
return ref.isStirring() ? Qtrue : Qfalse;
}
Sets the stirring state.
/*
call-seq: setStirring(val)
stirring=(val)
Sets the stirring state.
*/
VALUE DrawableText_setStirring(VALUE self, VALUE val)
{
DrawableText &ref = getRef<DrawableText>(self);
ref.setStirring(val == Qtrue);
return val;
}
Returns the text’s text.
/*
Returns the text's text.
*/
VALUE DrawableText_text(VALUE self)
{
DrawableText &ref = getRef<DrawableText>(self);
return rb_str_new2(ref.getText().c_str());
}
Toggle the scripted mode. When set to true, characters like n can be used.
/*
Toggle the scripted mode. When set to true, characters like \n can be used.
*/
VALUE DrawableText_toggleScripted(VALUE self)
{
DrawableText &ref = getRef<DrawableText>(self);
ref.toggleScripted();
return Qnil;
}