From fa0aa5ace64612e28969f55d1d29659a0ec15aa4 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 15 Aug 2014 16:22:03 +0100 Subject: [PATCH] Added storage for up to 5 mouse buttons for convenience (even though ImGui itself only uses 1) --- imgui.cpp | 2 -- imgui.h | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 40fca47a..39ff7be4 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -110,7 +110,6 @@ ISSUES AND TODO-LIST - misc: allow user to call NewFrame() multiple times without a render. - - misc: add extra mouse buttons for user storage (and clarify that ImGui doesn't use them) - misc: merge ImVec4 / ImGuiAabb, they are essentially duplicate containers - window: autofit is losing its purpose when user relies on any dynamic layout (window width multiplier, column). maybe just discard autofit? - window: support horizontal scroll @@ -151,7 +150,6 @@ - shortcuts: add a shortcut api, e.g. parse "&Save" and/or "Save (CTRL+S)", pass in to widgets or provide simple ways to use (button=activate, input=focus) - keyboard: full keyboard navigation and focus - misc: not thread-safe - - tooltip: add a BeginTooltip()/EndTooltip() helper. - optimisation/render: use indexed rendering - optimisation/render: move clip-rect to vertex data? would allow merging all commands - optimisation/render: merge command-list of all windows into one command-list? diff --git a/imgui.h b/imgui.h index 57be4ee8..1145d76c 100644 --- a/imgui.h +++ b/imgui.h @@ -402,7 +402,7 @@ struct ImGuiIO // Input - Fill before calling NewFrame() ImVec2 MousePos; // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) - bool MouseDown[2]; // Mouse buttons + bool MouseDown[5]; // Mouse buttons. ImGui itself only uses button 0 (left button) but you can use others as storage for convenience. int MouseWheel; // Mouse wheel: -1,0,+1 bool KeyCtrl; // Keyboard modifier pressed: Control bool KeyShift; // Keyboard modifier pressed: Shift @@ -419,11 +419,11 @@ struct ImGuiIO // [Internal] ImGui will maintain those fields for you ImVec2 MousePosPrev; ImVec2 MouseDelta; - bool MouseClicked[2]; - ImVec2 MouseClickedPos[2]; - float MouseClickedTime[2]; - bool MouseDoubleClicked[2]; - float MouseDownTime[2]; + bool MouseClicked[5]; + ImVec2 MouseClickedPos[5]; + float MouseClickedTime[5]; + bool MouseDoubleClicked[5]; + float MouseDownTime[5]; float KeysDownTime[512]; ImGuiIO();