diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2021-03-08 22:35:45 +0100 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2021-03-08 22:35:45 +0100 |
| commit | a14e25e7954b6101830c604f87694da5aee7625f (patch) | |
| tree | 8102208dedfc523b7830920c7b437ab65b8b73fe /src/main.cpp | |
| parent | e6d55c22bee063057c0f7b529baff2936e882f3d (diff) | |
Forward inputs to imgui
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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; } |
