本文整理汇总了C++中Drawable::SetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Drawable::SetColor方法的具体用法?C++ Drawable::SetColor怎么用?C++ Drawable::SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drawable
的用法示例。
在下文中一共展示了Drawable::SetColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Drawable_initialize
static VALUE Drawable_initialize(int argc, VALUE *argv, VALUE vSelf) {
// Get C++ object pointer from vSelf
Drawable *pSelf;
Data_Get_Struct(vSelf, Drawable, pSelf);
if(argc == 0) {
// Nothing to initialize
} else if(argc >= 1 && argc <= 5 && (argc < 5 || IS(argv[4], g_cColor))) {
if(argc >= 1)
pSelf->SetLeft((float)NUM2DBL(argv[0]));
if(argc >= 2)
pSelf->SetTop((float)NUM2DBL(argv[1]));
if(argc >= 3) {
if(ISNUM(argv[2])) {
float f = (float)NUM2DBL(argv[2]);
pSelf->SetScale(f, f);
} else if(IS(argv[2], rb_cArray)) {
float x = (float)NUM2DBL(rb_ary_entry(argv[2], 0));
float y = (float)NUM2DBL(rb_ary_entry(argv[2], 1));
pSelf->SetScale(x, y);
}
}
if(argc >= 4)
pSelf->SetRotation((float)NUM2DBL(argv[3]));
if(argc >= 5)
pSelf->SetColor(*(Color *)DATA_PTR(argv[4]));
} else
rb_raise(rb_eTypeError, "wrong argument type(s)");
return vSelf;
}
示例2: Drawable_set_color
static VALUE Drawable_set_color(VALUE vSelf, VALUE vColor) {
// Get C++ object pointer from vSelf
Drawable *pSelf;
Data_Get_Struct(vSelf, Drawable, pSelf);
if(!IS(vColor, g_cColor))
rb_raise(rb_eTypeError, "wrong argument type(s)");
pSelf->SetColor(*(Color *)DATA_PTR(vColor));
return Qnil;
}
示例3: SetText
void TextDraw::SetText(
Drawable & draw,
const Font & font, const std::string & text,
float x, float y, float scalex, float scaley,
float r, float g, float b,
VertexArray & output_array)
{
RenderText(font, text, x, y, scalex, scaley, output_array);
draw.SetTextures(font.GetFontTexture()->GetId());
draw.SetVertArray(&output_array);
draw.SetCull(false, false);
draw.SetColor(r, g, b, 1.0);
}