Skip to content

Commit af2b95c

Browse files
committed
Add gamepad support for level changer window
1 parent ac8e7bf commit af2b95c

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/xrGame/Level_input.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,6 @@ void CLevel::IR_GamepadKeyPress(int id)
715715
}
716716
return;
717717
}
718-
if (Device.Paused())
719-
return;
720718

721719
switch ( _curr )
722720
{
@@ -766,6 +764,8 @@ void CLevel::IR_GamepadKeyPress(int id)
766764

767765
if (b_ui_exist && CurrentGameUI()->IR_UIOnGamepadKeyPress(id)) return;
768766

767+
if (Device.Paused())
768+
return;
769769

770770
if (CURRENT_ENTITY())
771771
{

src/xrGame/ui/UIGameCustom.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,27 @@ bool CChangeLevelWnd::OnKeyboardAction(int dik, EUIMessages keyboard_action)
880880
return inherited::OnKeyboardAction(dik, keyboard_action);
881881
}
882882

883+
bool CChangeLevelWnd::OnGamepadKeyAction(int id, EUIMessages gamepad_action)
884+
{
885+
if (gamepad_action == WINDOW_KEY_PRESSED)
886+
{
887+
switch (get_binded_action(id, agUIGeneral))
888+
{
889+
case kUI_ACCEPT:
890+
{
891+
OnOk();
892+
return true;
893+
}
894+
case kUI_BACK:
895+
{
896+
OnCancel();
897+
return true;
898+
}
899+
}
900+
}
901+
return inherited::OnGamepadKeyAction(id, gamepad_action);
902+
}
903+
883904
bool g_block_pause = false;
884905
void CChangeLevelWnd::Show(bool status)
885906
{

src/xrGame/ui/UIGameCustom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class CChangeLevelWnd : public CUIDialogWnd
110110
virtual bool WorkInPause()const { return true; }
111111
virtual void Show(bool status);
112112
virtual bool OnKeyboardAction(int dik, EUIMessages keyboard_action);
113+
virtual bool OnGamepadKeyAction(int id, EUIMessages gamepad_action);
113114

114115
virtual CUIWindow* ui_cast_window() { return this; }
115116
};

0 commit comments

Comments
 (0)