MCPcopy Create free account
hub / github.com/chrxh/alien / processEvents

Method processEvents

source/Gui/SimulationInteractionController.cpp:108–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void SimulationInteractionController::processEvents()
109{
110 auto mousePos = ImGui::GetMousePos();
111 IntVector2D mousePosInt{toInt(mousePos.x), toInt(mousePos.y)};
112 IntVector2D prevMousePosInt = _prevMousePosInt ? *_prevMousePosInt : mousePosInt;
113
114 if (!ImGui::GetIO().WantCaptureMouse) {
115 if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
116 leftMouseButtonPressed(mousePosInt);
117 }
118 if (ImGui::IsMouseDown(ImGuiMouseButton_Left)) {
119 leftMouseButtonHold(mousePosInt, prevMousePosInt);
120 }
121 if (ImGui::GetIO().MouseWheel > 0) {
122 mouseWheelUp(mousePosInt, std::abs(ImGui::GetIO().MouseWheel));
123 }
124
125 if (ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
126 rightMouseButtonPressed(mousePosInt);
127 }
128 if (ImGui::IsMouseDown(ImGuiMouseButton_Right)) {
129 rightMouseButtonHold(mousePosInt, prevMousePosInt);
130 }
131 if (ImGui::GetIO().MouseWheel < 0) {
132 mouseWheelDown(mousePosInt, std::abs(ImGui::GetIO().MouseWheel));
133 }
134
135 if (ImGui::IsMouseClicked(ImGuiMouseButton_Middle)) {
136 middleMouseButtonPressed(mousePosInt);
137 }
138 if (ImGui::IsMouseDown(ImGuiMouseButton_Middle)) {
139 middleMouseButtonHold(mousePosInt);
140 }
141 drawCursor();
142 }
143 if (ImGui::IsMouseReleased(ImGuiMouseButton_Left)) {
144 leftMouseButtonReleased(mousePosInt, prevMousePosInt);
145 }
146 if (ImGui::IsMouseReleased(ImGuiMouseButton_Right)) {
147 rightMouseButtonReleased();
148 }
149 if (ImGui::IsMouseReleased(ImGuiMouseButton_Middle)) {
150 middleMouseButtonReleased();
151 }
152
153 processMouseWheel(mousePosInt);
154
155 _prevMousePosInt = mousePosInt;
156}
157
158void SimulationInteractionController::leftMouseButtonPressed(IntVector2D const& mousePos)
159{

Callers

nothing calls this directly

Calls 1

toIntFunction · 0.85

Tested by

no test coverage detected