소스 검색

Added storage for up to 5 mouse buttons for convenience (even though ImGui itself only uses 1)

ocornut 11 년 전
부모
커밋
fa0aa5ace6
2개의 변경된 파일6개의 추가작업 그리고 8개의 파일을 삭제
  1. 0 2
      imgui.cpp
  2. 6 6
      imgui.h

+ 0 - 2
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?

+ 6 - 6
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();