aboutsummaryrefslogtreecommitdiff
path: root/src/client/callbackhandeler.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-03-09 23:55:49 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2018-03-09 23:55:49 -0500
commit2831e232b886c5e3b0791ea5192f9e5194e6abf3 (patch)
tree4fb9309d18f388673b7a21b8f0e927727006f585 /src/client/callbackhandeler.cpp
parent35b7c646fd7f80b64c1ef49b6d81f9df9bc1b940 (diff)
downloadbrokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.tar.gz
brokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.tar.bz2
brokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.zip
Added IGUIImages
Added the ability to display itextures on the gui
Diffstat (limited to 'src/client/callbackhandeler.cpp')
-rw-r--r--src/client/callbackhandeler.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/client/callbackhandeler.cpp b/src/client/callbackhandeler.cpp
index c548624..cf24cd2 100644
--- a/src/client/callbackhandeler.cpp
+++ b/src/client/callbackhandeler.cpp
@@ -31,6 +31,7 @@ GlobalEventReceiver::GlobalEventReceiver(IrrlichtDevice* d){
}
bool GlobalEventReceiver::OnEvent(const SEvent& e){
EEVENT_TYPE type = e.EventType;
+ //printf("Onevent called:%d\n",(int)type);
switch (type){
case EET_GUI_EVENT:{
IGUIElement* caller = e.GUIEvent.Caller;
@@ -48,12 +49,15 @@ bool GlobalEventReceiver::OnEvent(const SEvent& e){
SEvent::SMouseInput se = e.MouseInput;
//printf("X: %d Y: %d\n",se.X, se.Y);
- lua_getglobal(L,"GAME");
- lua_getfield(L,-1,"onMouseMove");
+ lua_getglobal(L,"GAME");//{}
+ lua_getfield(L,-1,"onMouseMove");//{},onMouseMove()
if(!lua_isnil(L,-1)){
lua_pushnumber(L,se.X);
lua_pushnumber(L,se.Y);
lua_call(L,2,0);
+ lua_pop(L,1);
+ }else{
+ lua_pop(L,2);
}
break;
}
@@ -68,11 +72,14 @@ bool GlobalEventReceiver::OnEvent(const SEvent& e){
lua_pushboolean(L,se.Control);
lua_pushboolean(L,se.Shift);
lua_call(L,4,0);
+ lua_pop(L,1);
+ }else{
+ lua_pop(L,2);
}
break;
}
default:
- //printf("Called an unknown event\n");
+ printf("Called an unknown event\n");
return false;
}
}