diff options
Diffstat (limited to 'src/client/lua_api/gui')
| -rw-r--r-- | src/client/lua_api/gui/iguibutton.cpp | 46 | ||||
| -rw-r--r-- | src/client/lua_api/gui/iguielement.cpp | 71 | ||||
| -rw-r--r-- | src/client/lua_api/gui/iguiimage.cpp | 29 | ||||
| -rw-r--r-- | src/client/lua_api/gui/iguilabel.cpp | 6 | ||||
| -rw-r--r-- | src/client/lua_api/gui/iguiwindow.cpp | 12 | ||||
| -rw-r--r-- | src/client/lua_api/gui/simple.cpp | 10 |
6 files changed, 5 insertions, 169 deletions
diff --git a/src/client/lua_api/gui/iguibutton.cpp b/src/client/lua_api/gui/iguibutton.cpp index 25a30ed..2d04fd1 100644 --- a/src/client/lua_api/gui/iguibutton.cpp +++ b/src/client/lua_api/gui/iguibutton.cpp @@ -24,52 +24,6 @@ using namespace gui; extern IrrlichtDevice* device; char lhashkey[20]; -//static LIGUIElement* checkiguibutton(lua_State* L, int index){ - //void* ud = luaL_checkudata(L,index,"gui.iguibutton"); - //luaL_argcheck(L,ud != NULL, index, "'gui.iguibutton' expected"); - //return (LIGUIElement*) ud; -//} - -//static LIGUIElement* checkiguibutton(lua_State* L){ - //return checkiguibutton(L,1); -//} - -//The callback even for all gui buttons -//static bool iguibuttonevent(irr::SEvent e){ - //IGUIElement* caller = (IGUIElement*)e.GUIEvent.Caller; - //printf("Some gui something somewhere was pressed\n"); - //if(iguielements.find(caller) != iguielements.end()){ - //printf("I know what reference is linked to that button: %d!\n",iguielements[caller]); - //int ref = iguielements[caller]; - //EGUI_EVENT_TYPE etype = e.GUIEvent.EventType; - //if(etype == EGET_BUTTON_CLICKED){ - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //printf("getting raw, the thing on the top of stack is a %s\n",luaL_typename(tL,-1)); - //LIGUIElement* tbut = checkiguibutton(tL,-1); - //int hashmapresponse; - //char* hashkey = (char*)"onpress"; - //int terror = hashmap_get(tbut->funcmap,hashkey,(void**)&hashmapresponse); - //if(terror == MAP_OK){ - //lua_rawgeti(tL,LUA_REGISTRYINDEX,hashmapresponse); - //lua_call(tL,0,0); - //}else{ - //printf("Tried to call onpress on something that dosen't have onpress\n"); - //} - //}else if(etype == EGET_ELEMENT_HOVERED){ - //printf("Trying to call onhovered!\n"); - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //LIGUIElement* tbut = (LIGUIElement*)lua_touserdata(tL,-1); - //int hashmapresponse; - //int terror = hashmap_get(tbut->funcmap,(char*)"onhovered",(void**)&hashmapresponse); - //if(terror == MAP_OK){ - //lua_rawgeti(tL,LUA_REGISTRYINDEX,hashmapresponse); - //lua_call(tL,0,0); - //} - //} - //} - //return false; -//} - //gui.newbutton({{sx,sy},{ex,ey}},"text"[,parent]) static int newiguibutton(lua_State* L){ printf("Createing gui button!\n"); diff --git a/src/client/lua_api/gui/iguielement.cpp b/src/client/lua_api/gui/iguielement.cpp index bdc13df..0fb25f1 100644 --- a/src/client/lua_api/gui/iguielement.cpp +++ b/src/client/lua_api/gui/iguielement.cpp @@ -15,17 +15,6 @@ using namespace irr; using namespace core; using namespace gui; -//static LIGUIElement* toiguielement(lua_State* L,int index){ - //LIGUIElement* ret = (LIGUIElement*)lua_touserdata(L,index); - //if(ret == NULL) - //luaL_typerror(L,index,"LIGUIButton"); - //return ret; -//} - -//static LIGUIElement* toiguielement(lua_State* L){ - //return toiguielement(L,1); -//} - //move({element},{x,y}) -> nil int moveiguielement(lua_State* L){ //printf("Got call to move element\n"); @@ -58,15 +47,6 @@ int getiguiclippingrect(lua_State* L){ ); return 1; } -/* -int moveiguielement(lua_State* L){ - LIGUIElement* ele = toiguielement(L,1); - int x = luaL_optint(L,2,0); - int y = luaL_optint(L,3,0); - ele->e->move(position2d<s32>(x,y)); - return 0; -} -*/ //setText({guielement},"text") :: nil int setiguitext(lua_State* L){ @@ -122,60 +102,9 @@ public: //{guielement} //popelementcallback(lua_State* L, gui::EGUI_EVENT_TYPE, char*) void setelementcallback(lua_State* L,gui::EGUI_EVENT_TYPE et, const char* funcname){ - //lua_getfield(L,-1,"guielement");//{guielement} - //IGUIElement* el = (IGUIElement*)lua_touserdata(L,-1);//{guielement},ud_element - //lua_pop(L,1);//{guielement} registerguielement(L); - //int ref = luaL_ref(L,LUA_REGISTRYINDEX);// - //guicallback* gc = new guicallback(L,ref,funcname);//TODO:Clean this up somehow - //popregisterguicallback(el,et, gc); - //lua_rawgeti(L,LUA_REGISTRYINDEX,ref);//{guielement} } -//int guigethandeler(lua_State* L){ - //printf("Called the get index handeler!\n"); - //LIGUIElement* button = toiguielement(L); - //if(!lua_isstring(L,2)){ - //luaL_error(L,"index of iguibutton must be of type 'string'"); - //} - //const char* lstr = lua_tostring(L,2); - //char* hashkey = (char*)malloc(sizeof(char)*strlen(lstr)); - //strcpy(hashkey,lstr); - //int ref; - //if(hashmap_get(button->funcmap,hashkey,(void**)&ref) == MAP_OK){ - ////We found the value in our hashmap! - //lua_rawgeti(L,LUA_REGISTRYINDEX,ref); - //return 1; - //}else{ - ////Could not find in hashmap, check parrent - //lua_getglobal(L,button->type); - //printf("Button's type is %s\n",button->type); - //lua_getfield(L,-1,lstr); - //return 1; - //} -//} - -//int guisethandeler(lua_State* L){ - //printf("Called the set index handeler\n"); - //LIGUIElement* button = toiguielement(L); - //if(!lua_isstring(L,2)){ - //luaL_error(L,"index of iguibutton must be of type 'string'"); - //} - //const char* lstr = lua_tostring(L,2); - //char* hashkey = (char*)malloc(sizeof(char)*strlen(lstr)); - //strcpy(hashkey,lstr); - //int oldref; - //if(hashmap_get(button->funcmap,hashkey,(void**)&oldref) == MAP_OK){ - //luaL_unref(L,LUA_REGISTRYINDEX,oldref); - //hashmap_remove(button->funcmap,hashkey); - //} - //int ref = luaL_ref(L,LUA_REGISTRYINDEX); - //if(hashmap_put(button->funcmap,hashkey,(void*)ref) != MAP_OK){ - //luaL_error(L,"Error while setting the hashkey on iguibutton"); - //} - //return 0; -//} - //ud_iguielement int guigetid(lua_State* L){ IGUIElement* el = (IGUIElement*)lua_touserdata(L,-1); diff --git a/src/client/lua_api/gui/iguiimage.cpp b/src/client/lua_api/gui/iguiimage.cpp index 0428344..13a52b6 100644 --- a/src/client/lua_api/gui/iguiimage.cpp +++ b/src/client/lua_api/gui/iguiimage.cpp @@ -22,35 +22,6 @@ using namespace gui; extern IrrlichtDevice* device; extern IGUIEnvironment* env; -//IrrlichtDevice* guidevice; - - -//static bool iguiimageevent(irr::SEvent e){ - //IGUIElement* caller = (IGUIElement*)e.GUIEvent.Caller; - //int ref = iguielements[caller]; - //EGUI_EVENT_TYPE etype = e.GUIEvent.EventType; - //printf("Detected image event\n"); - //if(etype == EGET_ELEMENT_CLOSED){ - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //printf("getting raw, the thing on the top of stack is a %s\n",luaL_typename(tL,-1)); - //LIGUIElement* tbut = checkiguiwindow(tL,-1); - //int hashmapresponse; - //char* hashkey = (char*)"onclose"; - //int terror = hashmap_get(tbut->funcmap,hashkey,(void**)&hashmapresponse); - //if(terror == MAP_OK){ //Only call if we actually have that function. - //printf("Looks like we have an onclose function, calling!\n"); - //lua_rawgeti(tL,LUA_REGISTRYINDEX,hashmapresponse); //push the function - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); //push the referance to iguielement - //lua_call(tL,1,1); - ////int b = lua_isnoneornil(tL,1); - //int a = lua_toboolean(tL,-1); - //printf("a:%d\n",a); - //return a; - //} - //} - //printf("Oh no! an iguiimage generated an event!"); - //return false; -//} //new({startx,starty},alpha,{itexture}) -> {guielement} static int newiguiimage(lua_State* L){ diff --git a/src/client/lua_api/gui/iguilabel.cpp b/src/client/lua_api/gui/iguilabel.cpp index dce1b15..578bca7 100644 --- a/src/client/lua_api/gui/iguilabel.cpp +++ b/src/client/lua_api/gui/iguilabel.cpp @@ -22,12 +22,6 @@ using namespace gui; extern IrrlichtDevice* device; -//IrrlichtDevice* guidevice; -//static bool iguilabelevent(irr::SEvent e){ - //printf("Oh no! an iguilabel generated an event!"); - //return false; -//} - //gui.newguilabel({{sx,sy},{ex,ey}},"text"[,parent]) :: {guielement} static int newiguilabel(lua_State* L){ printf("Createing label!\n"); diff --git a/src/client/lua_api/gui/iguiwindow.cpp b/src/client/lua_api/gui/iguiwindow.cpp index 30af486..fc85217 100644 --- a/src/client/lua_api/gui/iguiwindow.cpp +++ b/src/client/lua_api/gui/iguiwindow.cpp @@ -20,18 +20,6 @@ extern "C" { using namespace irr; using namespace gui; -//static bool iguiwindowevent(irr::SEvent e){ - //int ref = iguielements[e.GUIEvent.Caller]; - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //lua_getfield(tL,-1,"close"); - - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //lua_call(tL,1,1); - - //int shouldclose = lua_toboolean(tL,-1); - //return shouldclose == 1; -//} - //new({{sx,sy},{ex,ey}},"title"[,{guielement=parent}]) :: {guielement} static int newiguiwindow(lua_State* L){ IGUIElement* parent = NULL; diff --git a/src/client/lua_api/gui/simple.cpp b/src/client/lua_api/gui/simple.cpp index 8790069..8e8b237 100644 --- a/src/client/lua_api/gui/simple.cpp +++ b/src/client/lua_api/gui/simple.cpp @@ -1,8 +1,8 @@ -#include <irrlicht.h>
-extern "C" {
- #include <lua.h>
- #include <lauxlib.h>
- #include <lualib.h>
+#include <irrlicht.h>
+extern "C" {
+ #include <lua.h>
+ #include <lauxlib.h>
+ #include <lualib.h>
}
// {{startx, starty},{endx,endy}}
|
