From 2831e232b886c5e3b0791ea5192f9e5194e6abf3 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Fri, 9 Mar 2018 23:55:49 -0500 Subject: Added IGUIImages Added the ability to display itextures on the gui --- src/client/callbackhandeler.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/client/callbackhandeler.cpp') 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; } } -- cgit v1.2.3-70-g09d2