Fix DInput cursor going to +infinite if the window size was 0

This commit is contained in:
Filippo Tarpini 2021-01-02 18:33:13 +02:00 committed by GitHub
parent 75f35393c3
commit 5a5c815ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -126,9 +126,9 @@ void KeyboardMouse::UpdateCursorInput()
RECT rect;
GetClientRect(m_hwnd, &rect);
// Width and height are the size of the rendering window.
const auto win_width = rect.right - rect.left;
const auto win_height = rect.bottom - rect.top;
// Width and height are the size of the rendering window. They could be 0
const auto win_width = std::max(rect.right - rect.left, 1l);
const auto win_height = std::max(rect.bottom - rect.top, 1l);
const auto window_scale = g_controller_interface.GetWindowInputScale();