Change mouse icon on hover

This commit is contained in:
Adria 2026-04-16 13:04:16 +02:00
parent 78d4bc80cf
commit 5f65864000
3 changed files with 17 additions and 0 deletions

View file

@ -1004,6 +1004,15 @@ void UIController::tickInput()
}
}
}
if (hitCtrl && (hitCtrl->getControlType() == UIControl::eButton || hitCtrl->getControlType() == UIControl::eCheckBox || hitCtrl->getControlType() == UIControl::eButtonList || hitCtrl->getControlType() == UIControl::eSaveList))
g_KBMInput.SetCursorIcon(MAKEINTRESOURCEW(IDC_HAND));
else if (hitCtrl && hitCtrl->getControlType() == UIControl::eSlider || hitCtrl && hitCtrl->getControlType() == UIControl::eTexturePackList)
g_KBMInput.SetCursorIcon(MAKEINTRESOURCEW(IDC_SIZEWE));
else if (hitCtrl && hitCtrl->getControlType() == UIControl::eTextInput)
g_KBMInput.SetCursorIcon(MAKEINTRESOURCEW(IDC_IBEAM));
else if (hitCtrl && hitCtrl->getControlType() == UIControl::eNoControl)
g_KBMInput.SetCursorIcon(MAKEINTRESOURCEW(IDC_ARROW));
}
}

View file

@ -390,6 +390,12 @@ float KeyboardMouseInput::GetLookY(float sensitivity) const
return static_cast<float>(-m_mouseDeltaY) * sensitivity;
}
void KeyboardMouseInput::SetCursorIcon(LPCWSTR cursorName)
{
HCURSOR hCursor = LoadCursorW(nullptr, cursorName);
if (hCursor) SetCursor(hCursor);
}
void KeyboardMouseInput::OnChar(wchar_t c)
{
int next = (m_charBufferHead + 1) % CHAR_BUFFER_SIZE;

View file

@ -105,6 +105,8 @@ public:
float GetLookX(float sensitivity) const;
float GetLookY(float sensitivity) const;
void SetCursorIcon(LPCWSTR cursorName);
private:
bool m_keyDown[MAX_KEYS];
bool m_keyDownPrev[MAX_KEYS];