Skip to content

Commit

Permalink
Added int Widget(lua_State* L).
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenliang committed Apr 29, 2011
1 parent 9549d0c commit 760b3cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
22 changes: 19 additions & 3 deletions engine/ui_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
void RegisterUICreators()
{
ScriptManager& scriptMgr = ScriptManager::GetInstance();

scriptMgr.RegisterFunc("Button", Button);
scriptMgr.RegisterFunc("Label", Label);
scriptMgr.RegisterFunc("Line", Line);
scriptMgr.RegisterFunc("Panel", Panel);
scriptMgr.RegisterFunc("Progressbar", Progressbar);
scriptMgr.RegisterFunc("Widget", Widget);
scriptMgr.RegisterFunc("Window", Window_);
}

Expand Down Expand Up @@ -143,7 +145,7 @@ namespace

}

int Button( lua_State* L )
int Button(lua_State* L)
{
UIButton* btn = new UIButton;

Expand All @@ -164,7 +166,7 @@ int Button( lua_State* L )
return 1;
}

int Label( lua_State* L )
int Label(lua_State* L)
{
UILabel* label = new UILabel;

Expand Down Expand Up @@ -212,7 +214,7 @@ int Line(lua_State* L)
return 1;
}

int Panel( lua_State* L )
int Panel(lua_State* L)
{
UIPanel* panel = new UIPanel;

Expand Down Expand Up @@ -277,3 +279,17 @@ int Window_( lua_State* L )

return 1;
}

int Widget(lua_State* L)
{
UIWindow* widget = new UIWindow;

SetName(L, widget);
SetTextUserData(L, widget);

AddWidget(L, widget);

lua_pushlightuserdata(L, widget);

return 1;
}
1 change: 1 addition & 0 deletions engine/ui_lua.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ int Line(lua_State* L);
int Panel(lua_State* L);
int Progressbar(lua_State* L);
int Window_(lua_State* L);
int Widget(lua_State* L);

0 comments on commit 760b3cc

Please sign in to comment.