mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-15 12:29:01 +00:00
glfw: scale cursor position by the ratio of framebuffer to screen size
This fixes the mouse being constrained to the top left quarter of the window on Wayland HiDPI setups.
This commit is contained in:
parent
d05c50ea74
commit
7c1497a058
1 changed files with 5 additions and 2 deletions
|
@ -1438,8 +1438,11 @@ _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
|
|||
// TODO this only works in frontend(and luckily only frontend use this). Fun fact: if I get pos manually in game, glfw reports that it's > 32000
|
||||
void
|
||||
cursorCB(GLFWwindow* window, double xpos, double ypos) {
|
||||
FrontEndMenuManager.m_nMouseTempPosX = xpos;
|
||||
FrontEndMenuManager.m_nMouseTempPosY = ypos;
|
||||
int bufw, bufh, winw, winh;
|
||||
glfwGetWindowSize(window, &winw, &winh);
|
||||
glfwGetFramebufferSize(window, &bufw, &bufh);
|
||||
FrontEndMenuManager.m_nMouseTempPosX = xpos * (bufw / winw);
|
||||
FrontEndMenuManager.m_nMouseTempPosY = ypos * (bufh / winh);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue