Skip to content

Commit

Permalink
CUIMessageBox: hide cursor in gamepad mode when it's not needed at all
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jan 17, 2025
1 parent 27a81c8 commit 7507b98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/xrGame/ui/UIMessageBoxEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ void CUIMessageBoxEx::OnNOClicked(CUIWindow* w, void* d)
}
}

bool CUIMessageBoxEx::NeedCursor() const
{
if (pInput->IsCurrentInputTypeKeyboardMouse())
return true;

switch (m_pMessageBox->GetBoxStyle())
{
case CUIMessageBox::MESSAGEBOX_DIRECT_IP:
case CUIMessageBox::MESSAGEBOX_PASSWORD:
case CUIMessageBox::MESSAGEBOX_RA_LOGIN:
case CUIMessageBox::MESSAGEBOX_YES_NO_COPY:
return true;
}

return false;
}

void CUIMessageBoxEx::SetText(LPCSTR text) { m_pMessageBox->SetText(text); }
LPCSTR CUIMessageBoxEx::GetText() { return m_pMessageBox->GetText(); }
void CUIMessageBoxEx::SendMessage(CUIWindow* pWnd, s16 msg, void* pData /* = NULL */)
Expand Down
3 changes: 2 additions & 1 deletion src/xrGame/ui/UIMessageBoxEx.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class CUIMessageBoxEx final : public CUIDialogWnd, public CUIWndCallback
void OnOKClicked(CUIWindow*, void*);
void OnNOClicked(CUIWindow*, void*);

virtual bool NeedCenterCursor() const { return false; }
bool NeedCursor() const override;
bool NeedCenterCursor() const override { return false; }
CUIMessageBox* m_pMessageBox;

pcstr GetDebugType() override { return "CUIMessageBoxEx"; }
Expand Down

0 comments on commit 7507b98

Please sign in to comment.