summaryrefslogtreecommitdiff
path: root/Runtime/Events/InputEvent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Events/InputEvent.cpp')
-rw-r--r--Runtime/Events/InputEvent.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/Runtime/Events/InputEvent.cpp b/Runtime/Events/InputEvent.cpp
index e741511..bfa7a1e 100644
--- a/Runtime/Events/InputEvent.cpp
+++ b/Runtime/Events/InputEvent.cpp
@@ -320,4 +320,36 @@ void InputEvent::RestoreFromTable(LuaBind::State& state, int idx)
}
state.SetTop(top);
+}
+
+void InputEvent::Init()
+{
+ mousePosition = Vector2f(0.0F, 0.0F);
+ mouseDelta = Vector2f(0.0F, 0.0F);
+ type = InputEvent_Ignore;
+ keycode = 0;
+ character = 0;
+ button = 0;
+ clickCount = 0;
+ pressure = 0;
+ modifiers = 0;
+ commandString = NULL;
+}
+
+InputEvent InputEvent::RepaintEvent(HWND window)
+{
+ InputEvent evt;
+ evt.Init();
+ evt.type = InputEvent_Repaint;
+
+ Vector2f p = GetInputMousePosition(window);
+ evt.mousePosition = p;
+ evt.button = 0;
+ bool swapped = GetSystemMetrics(SM_SWAPBUTTON);
+ if (GetAsyncKeyState(swapped ? VK_LBUTTON : VK_RBUTTON))
+ evt.button = Mouse_RightButton;
+ if (GetAsyncKeyState(swapped ? VK_RBUTTON : VK_LBUTTON))
+ evt.button = Mouse_LeftButton;
+
+ return evt;
} \ No newline at end of file