MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / AddMouseButtonEvent

Method AddMouseButtonEvent

extern/imgui/imgui.cpp:1481–1501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1479}
1480
1481void ImGuiIO::AddMouseButtonEvent(int mouse_button, bool down)
1482{
1483 ImGuiContext& g = *GImGui;
1484 IM_ASSERT(&g.IO == this && "Can only add events to current context.");
1485 IM_ASSERT(mouse_button >= 0 && mouse_button < ImGuiMouseButton_COUNT);
1486 if (!AppAcceptingEvents)
1487 return;
1488
1489 // Filter duplicate
1490 const ImGuiInputEvent* latest_event = FindLatestInputEvent(ImGuiInputEventType_MouseButton, (int)mouse_button);
1491 const bool latest_button_down = latest_event ? latest_event->MouseButton.Down : g.IO.MouseDown[mouse_button];
1492 if (latest_button_down == down)
1493 return;
1494
1495 ImGuiInputEvent e;
1496 e.Type = ImGuiInputEventType_MouseButton;
1497 e.Source = ImGuiInputSource_Mouse;
1498 e.MouseButton.Button = mouse_button;
1499 e.MouseButton.Down = down;
1500 g.InputEventsQueue.push_back(e);
1501}
1502
1503// Queue a mouse wheel event (most mouse/API will only have a Y component)
1504void ImGuiIO::AddMouseWheelEvent(float wheel_x, float wheel_y)

Callers 1

Calls 2

FindLatestInputEventFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected