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; }
static VALUE Drawable_set_top(VALUE vSelf, VALUE vTop) { // Get C++ object pointer from vSelf Drawable *pSelf; Data_Get_Struct(vSelf, Drawable, pSelf); pSelf->SetTop((float)NUM2DBL(vTop)); return Qnil; }