You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mousePosScale.x = (float)display_w / w; // Some screens e.g. Retina display have framebuffer size != from window size, and mouse inputs are given in window/screen coordinates.
251
-
mousePosScale.y = (float)display_h / h;
252
-
253
244
ImGuiIO& io = ImGui::GetIO();
254
-
io.DisplaySize = ImVec2((float)display_w, (float)display_h); // Display size, in pixels. For clamping windows positions.
255
245
io.DeltaTime = 1.0f / 60.0f; // Time elapsed since last frame, in seconds (in this sample app we'll override this every frame because our timestep is variable)
io.DisplaySize = ImVec2((float)display_w, (float)display_h); // Display size, in pixels. For clamping windows positions.
293
+
294
+
// Setup time step
298
295
staticdouble time = 0.0f;
299
296
constdouble current_time = glfwGetTime();
300
297
io.DeltaTime = (float)(current_time - time);
@@ -304,7 +301,9 @@ void UpdateImGui()
304
301
// (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents())
305
302
double mouse_x, mouse_y;
306
303
glfwGetCursorPos(window, &mouse_x, &mouse_y);
307
-
io.MousePos = ImVec2((float)mouse_x * mousePosScale.x, (float)mouse_y * mousePosScale.y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
308
307
io.MouseDown[0] = mousePressed[0] || glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
mousePosScale.x = (float)display_w / w; // Some screens e.g. Retina display have framebuffer size != from window size, and mouse inputs are given in window/screen coordinates.
161
-
mousePosScale.y = (float)display_h / h;
162
-
163
154
ImGuiIO& io = ImGui::GetIO();
164
-
io.DisplaySize = ImVec2((float)display_w, (float)display_h); // Display size, in pixels. For clamping windows positions.
165
155
io.DeltaTime = 1.0f/60.0f; // Time elapsed since last frame, in seconds (in this sample app we'll override this every frame because our time step is variable)
io.DisplaySize = ImVec2((float)display_w, (float)display_h); // Display size, in pixels. For clamping windows positions.
227
+
231
228
// Setup time step
232
229
staticdouble time = 0.0f;
233
230
constdouble current_time = glfwGetTime();
@@ -238,7 +235,9 @@ void UpdateImGui()
238
235
// (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents())
239
236
double mouse_x, mouse_y;
240
237
glfwGetCursorPos(window, &mouse_x, &mouse_y);
241
-
io.MousePos = ImVec2((float)mouse_x * mousePosScale.x, (float)mouse_y * mousePosScale.y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
242
241
io.MouseDown[0] = mousePressed[0] || glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
0 commit comments