diff options
Diffstat (limited to 'src/client/callbackhandeler.cpp')
| -rw-r--r-- | src/client/callbackhandeler.cpp | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/src/client/callbackhandeler.cpp b/src/client/callbackhandeler.cpp index d522e84..b6c0321 100644 --- a/src/client/callbackhandeler.cpp +++ b/src/client/callbackhandeler.cpp @@ -18,9 +18,6 @@ using namespace gui; using namespace std; extern lua_State* L; -/*** -@module GAME -*/ std::map<IGUIElement*, int> guielements; //For basic events @@ -90,8 +87,23 @@ bool GlobalEventReceiver::OnEvent(const SEvent& e){ printf("done getting gui element\n"); const char* fieldname; switch(get){ +/*** +(Callback)Called when an @{iguiwindow} is focused +If the function returns true, the element will not be focused. +@function iguiwindow:onFocus() +*/ case EGET_ELEMENT_FOCUSED: fieldname = "onFocus"; break; +/*** +(Callback)Called when an @{iguiwindow} is unfocused +If the function returns true, the element will not be unfocused. +@function iguiwindow:onUnfocus() +*/ case EGET_ELEMENT_FOCUS_LOST: fieldname = "onUnfocus"; break; +/*** +(Callback)Called when an @{iguielement is hovered over with the mouse. +If an element has child elements, you also get this call for each child element. +@function iguielement:onHover() +*/ case EGET_ELEMENT_HOVERED: fieldname = "onHover"; break; case EGET_ELEMENT_LEFT: fieldname = "onLeave"; break; case EGET_ELEMENT_CLOSED: fieldname = "onClose"; break; @@ -160,6 +172,14 @@ Detects when the mouse moves across the game. */ switch(se.Event){ case EMIE_MOUSE_MOVED:{ +/*** +(Callback)Detects mouse movement +Called whenever the mouse is moved +@function GAME.onMouseMove(x,y,button) +@tparam number x The x position that the mouse now occupies +@tparam number y The y position that the mouse now occupies +@tparam number button Will be EMIE_MOUSE_MOVED. +*/ return callMouse(L,"onMouseMove",se.X,se.Y,se.Event); } break; @@ -167,29 +187,74 @@ Detects when the mouse moves across the game. case EMIE_RMOUSE_PRESSED_DOWN: case EMIE_MMOUSE_PRESSED_DOWN:{ printf("Mouse down\n"); +/*** +(Callback)Detects mouse presses. +Called whenever the a mouse button has been pressed +@function GAME.onMouseDown(x,y,button) +@tparam number x The x position of the mouse +@tparam number y The y position of the mouse +@tparam number button Which mouse button was pressed. Will be one of: +EMIE_LMOUSE_PRESSED_DOWN, EMIE_RMOUSE_PRESSED_DOWN, or EMIE_MMOUSE_PRESSED_DOWN +*/ return callMouse(L,"onMouseDown",se.X,se.Y,se.Event); } break; case EMIE_LMOUSE_LEFT_UP: case EMIE_RMOUSE_LEFT_UP: case EMIE_MMOUSE_LEFT_UP:{ - printf("Mouse up\n"); +/*** +(Callback)Detects mouse presses. +Detects when the mouse has been released. +@function GAME.onMouseUp(x,y,button) +@tparam number x The x position of the mouse on the screen (in pixels) +@tparam number y The y position of the mouse +@tparam number button The mouse key that was clicked, will be one of: +EMIE_LMOUSE_LEFT_UP, EMIE_RMOUSE_LEFT_UP, or EMIE_MMOUSE_LEFT_UP. +*/ return callMouse(L,"onMouseUp",se.X,se.Y,se.Event); } break; case EMIE_MOUSE_WHEEL:{ +/*** +(Callback)Detects mouse scroll wheel. +Triggered whenever the scroll wheel moves up or down. +@function GAME.onMouseWheel(x,y,direction) +@tparam number x The x position of the mouse +@tparam number y The y position of the mouse +@tparam number direction The direction of the scroll wheel, -1, 0 or 1 +*/ return callMouse(L,"onMouseWheel",se.X,se.Y,se.Wheel); } break; case EMIE_RMOUSE_DOUBLE_CLICK: case EMIE_MMOUSE_DOUBLE_CLICK: case EMIE_LMOUSE_DOUBLE_CLICK:{ +/*** +(Callback)Detects double clicking. +Tirggered whenever the user double clicked in the screen. The speed for double +clicking is system defined, and may not be the same across platforms. +@function GAME.onDoubleClick(x,y,button) +@tparam number x The x position of the mouse +@tparam number y The y position of the mouse +@tparam number button Which button was double clicked. Will be one of: +EMIE_RMOUSE_DOUBLE_CLICK, EMIE_LMOUSE_DOUBLE_CLICK, or EMIE_MMOUSE_DOUBLE_CLICK +*/ return callMouse(L,"onDoubleClick",se.X,se.Y,se.Event); } break; case EMIE_RMOUSE_TRIPLE_CLICK: case EMIE_MMOUSE_TRIPLE_CLICK: case EMIE_LMOUSE_TRIPLE_CLICK:{ +/*** +(Callback)Detects triple clicking. +Triggered whenever the user tripple clicks on the screen. The speed for tripple +clicking is system defined, and may not be the same across platforms. +@function GAME.onTripleClick(x,y,button) +@tparam number x The x position of the mouse +@tparam number y The y position of the mouse +@tparam number button Which button was tripple clicked. Will be one of: +EMIE_RMOUSE_TRIPLE_CLICK, EMIE_MMOUSE_TRIPLE_CLICK, EMIE_LMOUSE_TRIPLE_CLICK +*/ return callMouse(L,"onTripleClick",se.X,se.Y,se.Event); } break; |
