@@ -279,7 +279,7 @@ public void dispose() {
279
279
}
280
280
}
281
281
282
- private void updateMousePosAndButtons (final float scaleX , final float scaleY ) {
282
+ private void updateMousePosAndButtons () {
283
283
final ImGuiIO io = ImGui .getIO ();
284
284
285
285
for (int i = 0 ; i < ImGuiMouseButton .COUNT ; i ++) {
@@ -297,7 +297,7 @@ private void updateMousePosAndButtons(final float scaleX, final float scaleY) {
297
297
glfwSetCursorPos (windowPtr , mousePosBackup .x , mousePosBackup .y );
298
298
} else {
299
299
glfwGetCursorPos (windowPtr , cursorPosX , cursorPosY );
300
- io .setMousePos ((float ) cursorPosX [0 ] * scaleX , (float ) cursorPosY [0 ] * scaleY );
300
+ io .setMousePos ((float ) cursorPosX [0 ], (float ) cursorPosY [0 ]);
301
301
}
302
302
}
303
303
}
@@ -400,19 +400,18 @@ public void newFrame() {
400
400
glfwGetWindowSize (windowPtr , winWidth , winHeight );
401
401
glfwGetFramebufferSize (windowPtr , fbWidth , fbHeight );
402
402
403
- final float scaleX = (float ) fbWidth [0 ] / winWidth [0 ];
404
- final float scaleY = (float ) fbHeight [0 ] / winHeight [0 ];
405
-
406
403
io .setDisplaySize ((float ) winWidth [0 ], (float ) winHeight [0 ]);
407
404
if (winWidth [0 ] > 0 && winHeight [0 ] > 0 ) {
405
+ final float scaleX = (float ) fbWidth [0 ] / winWidth [0 ];
406
+ final float scaleY = (float ) fbHeight [0 ] / winHeight [0 ];
408
407
io .setDisplayFramebufferScale (scaleX , scaleY );
409
408
}
410
409
411
410
final double currentTime = glfwGetTime ();
412
411
io .setDeltaTime (time > 0.0 ? (float ) (currentTime - time ) : 1.0f / 60.0f );
413
412
time = currentTime ;
414
413
415
- updateMousePosAndButtons (scaleX , scaleY );
414
+ updateMousePosAndButtons ();
416
415
updateMouseCursor ();
417
416
updateGamepads ();
418
417
}
0 commit comments