修复高DPI下工作不正常的BUG
This commit is contained in:
parent
6bb7d35497
commit
74025826b4
|
|
@ -199,7 +199,12 @@ e2d::Point e2d::Input::getMousePos()
|
|||
POINT mousePos;
|
||||
GetCursorPos(&mousePos);
|
||||
ScreenToClient(Window::getInstance()->getHWnd(), &mousePos);
|
||||
return Point((double)mousePos.x, (double)mousePos.y);
|
||||
|
||||
float dpiScaleX = 0.f, dpiScaleY = 0.f;
|
||||
Renderer::getFactory()->GetDesktopDpi(&dpiScaleX, &dpiScaleY);
|
||||
|
||||
return Point(static_cast<double>(mousePos.x * 96.f / dpiScaleX),
|
||||
static_cast<double>(mousePos.y * 96.f / dpiScaleX));
|
||||
}
|
||||
|
||||
double e2d::Input::getMouseDeltaX()
|
||||
|
|
|
|||
|
|
@ -426,7 +426,9 @@ LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
|
|||
|
||||
if (wParam == SIZE_RESTORED)
|
||||
{
|
||||
_instance->_size = Size(width, height);
|
||||
float dpiScaleX = 0.f, dpiScaleY = 0.f;
|
||||
Renderer::getFactory()->GetDesktopDpi(&dpiScaleX, &dpiScaleY);
|
||||
_instance->_size = Size(width * 96.f / dpiScaleX, height * 96.f / dpiScaleY);
|
||||
}
|
||||
|
||||
// 如果程序接收到一个 WM_SIZE 消息,这个方法将调整渲染
|
||||
|
|
|
|||
Loading…
Reference in New Issue