Mouse Button State
IsMouseDown
ImGuiMouseButton
Mouse button (0=left, 1=right, 2=middle)
bool
True if button is currently down
IsMouseClicked
GetMouseClickedCount() == 1.
ImGuiMouseButton
Mouse button to check
bool
default:"false"
If true, returns true on repeat clicks
bool
True if button was just clicked
IsMouseReleased
ImGuiMouseButton
Mouse button to check
bool
True if button was just released
IsMouseDoubleClicked
GetMouseClickedCount() == 2.
ImGuiMouseButton
Mouse button to check
bool
True if button was double-clicked
A double-click will also report
IsMouseClicked() == true.GetMouseClickedCount
ImGuiMouseButton
Mouse button to check
int
Number of clicks (0=not clicked, 1=single click, 2=double click, 3=triple click, etc.)
Mouse Position
GetMousePos
ImGui::GetIO().MousePos.
ImVec2
Mouse position in screen coordinates
GetMousePosOnOpeningCurrentPopup
BeginPopup() into. Useful to avoid user backing that value themselves.
ImVec2
Mouse position when popup was opened
IsMousePosValid
(-FLT_MAX, -FLT_MAX) to denote no mouse available.
const ImVec2*
default:"NULL"
Mouse position to check (NULL = use current mouse position)
bool
True if position is valid
Mouse Dragging
IsMouseDragging
io.MouseDraggingThreshold if lock_threshold < 0.0f.
ImGuiMouseButton
Mouse button to check
float
default:"-1.0f"
Distance threshold before considering dragging. Use -1.0f for default threshold.
bool
True if mouse is dragging
GetMouseDragDelta
ImGuiMouseButton
default:"0"
Mouse button to check
float
default:"-1.0f"
Distance threshold. Use -1.0f for
io.MouseDraggingThreshold.ImVec2
Drag delta in pixels
ResetMouseDragDelta
ImGuiMouseButton
default:"0"
Mouse button to reset
Mouse Hovering
IsMouseHoveringRect
const ImVec2&
Top-left corner of rectangle
const ImVec2&
Bottom-right corner of rectangle
bool
default:"true"
Whether to respect current clipping rectangle
bool
True if mouse is within rectangle
Mouse Cursor
GetMouseCursor
ImGui::NewFrame(), updated during the frame. Valid before Render().
ImGuiMouseCursor
Cursor type
SetMouseCursor
ImGuiMouseCursor
Cursor type to set
Mouse Cursor Types
Mouse Button Enum
These values are guaranteed to be stable. You can use 0/1 directly.
Mouse Capture
SetNextFrameWantCaptureMouse
io.WantCaptureMouse flag next frame. Equivalent to setting io.WantCaptureMouse after the next NewFrame() call.
bool
Whether to capture mouse