From 214c967df8154d58ed969006dd2e97c30a4dc89c Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 30 Nov 2014 12:28:21 +0000 Subject: [PATCH] Example code: warning fix + comments. --- examples/directx9_example/main.cpp | 4 ++-- examples/opengl_example/main.cpp | 2 +- imgui.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/directx9_example/main.cpp b/examples/directx9_example/main.cpp index 16141de2..d20836fa 100644 --- a/examples/directx9_example/main.cpp +++ b/examples/directx9_example/main.cpp @@ -154,8 +154,8 @@ LRESULT WINAPI MsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) io.MouseDown[1] = false; return true; case WM_MOUSEWHEEL: - // Mouse wheel: -1,0,+1 - io.MouseWheel = GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1 : -1; + // Mouse wheel uses integer on Windows + io.MouseWheel = GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f; return true; case WM_MOUSEMOVE: // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) diff --git a/examples/opengl_example/main.cpp b/examples/opengl_example/main.cpp index ff46b538..8dc96300 100644 --- a/examples/opengl_example/main.cpp +++ b/examples/opengl_example/main.cpp @@ -131,7 +131,7 @@ static void glfw_mouse_button_callback(GLFWwindow* window, int button, int actio static void glfw_scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { ImGuiIO& io = ImGui::GetIO(); - io.MouseWheel = yoffset; // Use fractional mouse wheel, 1.0 unit 3 lines. + io.MouseWheel = (float)yoffset; // Use fractional mouse wheel, 1.0 unit 5 lines. } static void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) diff --git a/imgui.h b/imgui.h index 0e73e11c..3da2be43 100644 --- a/imgui.h +++ b/imgui.h @@ -488,7 +488,7 @@ struct ImGuiIO ImVec2 MousePos; // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) bool MouseDown[5]; // Mouse buttons. ImGui itself only uses button 0 (left button) but you can use others as storage for convenience. - float MouseWheel; // Mouse wheel: 1 unit scrolls about 3 lines text. + float MouseWheel; // Mouse wheel: 1 unit scrolls about 5 lines text. bool KeyCtrl; // Keyboard modifier pressed: Control bool KeyShift; // Keyboard modifier pressed: Shift bool KeysDown[512]; // Keyboard keys that are pressed (in whatever order user naturally has access to keyboard data)