From a14e25e7954b6101830c604f87694da5aee7625f Mon Sep 17 00:00:00 2001 From: ladevieq Date: Mon, 8 Mar 2021 22:35:45 +0100 Subject: Forward inputs to imgui --- src/main.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 07e799b..9d201a1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -67,6 +67,7 @@ int main() { start = std::chrono::high_resolution_clock::now(); ImGuiIO& io = ImGui::GetIO(); + io.DeltaTime = delta_time; wnd.poll_events(); @@ -129,6 +130,31 @@ int main() { break; } + case EVENT_TYPES::BUTTON_PRESS: { + if (event.button == BUTTONS::LEFT) { + io.MouseDown[0] = true; + } + if (event.button == BUTTONS::RIGHT) { + io.MouseDown[1] = true; + } + break; + } + case EVENT_TYPES::BUTTON_RELEASE: { + if (event.button == BUTTONS::LEFT) { + io.MouseDown[0] = false; + } + if (event.button == BUTTONS::RIGHT) { + io.MouseDown[1] = false; + } + break; + } + case EVENT_TYPES::MOUSE_MOVE: { + io.MousePos = ImVec2 { + (float)event.x, + (float)event.y + }; + break; + } default: break; } -- cgit v1.3