mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 09:10: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
5654347c5d
commit
b95accb8ff
|
@ -1397,8 +1397,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
|
// 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
|
void
|
||||||
cursorCB(GLFWwindow* window, double xpos, double ypos) {
|
cursorCB(GLFWwindow* window, double xpos, double ypos) {
|
||||||
FrontEndMenuManager.m_nMouseTempPosX = xpos;
|
int bufw, bufh, winw, winh;
|
||||||
FrontEndMenuManager.m_nMouseTempPosY = ypos;
|
glfwGetWindowSize(window, &winw, &winh);
|
||||||
|
glfwGetFramebufferSize(window, &bufw, &bufh);
|
||||||
|
FrontEndMenuManager.m_nMouseTempPosX = xpos * (bufw / winw);
|
||||||
|
FrontEndMenuManager.m_nMouseTempPosY = ypos * (bufh / winh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue