int GetScale(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); lua_pushnumber(L, Target->GetScale().x); lua_pushnumber(L, Target->GetScale().y); return 2; }
int SetImageSkin(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); std::string iName = luaL_checkstring(L, 1); Target->SetImage(ImageLoader::LoadSkin(iName)); return 0; }
int SetAbsolutePosition(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); Vec2 NewPos(luaL_checknumber(L, 1), luaL_checknumber(L, 2)); Target->SetPosition(NewPos); return 0; }
int SetScale(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); double scalex = luaL_checknumber(L, 1), scaley = luaL_checknumber(L, 2); Target->SetScale( Vec2( scalex, scaley ) ); return 0; }
int GetAbsolutePosition(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); lua_pushnumber(L, Target->GetPosition().x); lua_pushnumber(L, Target->GetPosition().y); return 2; }
int Rotate(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); double delta = luaL_checknumber(L, 1); Target->AddRotation(delta); return 0; }
int Move(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); double x = luaL_checknumber(L, 1), y = luaL_checknumber(L, 2); Target->AddPosition( Vec2(x, y) ); return 0; }
int SetZ(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); uint32 Z = luaL_checknumber(L, 1); Target->SetZ(Z); return 0; }
int SetRotation(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); double rot = luaL_checknumber(L, 1); Target->SetRotation(rot); return 0; }
int GetSize(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); lua_pushnumber(L, Target->GetWidth()); lua_pushnumber(L, Target->GetHeight()); return 2; }
int CropByPixels(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); int x1 = luaL_checknumber(L, 1), y1 = luaL_checknumber(L, 2); int x2 = luaL_checknumber(L, 3), y2 = luaL_checknumber(L, 4); Target->SetCropByPixels(x1, x2, y1, y2); return 0; }
int SetSize(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); double W = luaL_checknumber(L, 1); double H = luaL_checknumber(L, 2); Target->SetSize(W, H); return 0; }
void DoBMPEventList (GraphObject2D &Obj, std::vector<AutoplayBMP> &Events, ImageList &Images, double SongTime) { for (std::vector<AutoplayBMP>::iterator b = Events.begin(); b != Events.end(); b++) { if (b->Time <= SongTime) { Image* Img = Images.GetFromIndex(b->BMP); if (Img != NULL) Obj.SetImage(Img, false); b = Events.erase(b); if (b == Events.end()) break; } } }
int GetRotation(lua_State *L) { GraphObject2D *Target = GetObjectFromState<GraphObject2D>(L, "Target"); lua_pushnumber(L, Target->GetRotation()); return 1; }