Skip to content

Commit

Permalink
Added helper functions to determine input type (gamepad or keyboard &…
Browse files Browse the repository at this point in the history
… mouse)

Reduces code length
  • Loading branch information
Xottab-DUTY committed Aug 10, 2023
1 parent 07fbd10 commit 9566601
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/xrEngine/xr_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ class ENGINE_API CInput
bool IsControllerAvailable() const { return !controllers.empty(); }
void EnableControllerSensors(bool enable);

auto GetCurrentInputType() { return currentInputType; }
auto GetCurrentInputType() const { return currentInputType; }
auto IsCurrentInputTypeController() const { return GetCurrentInputType() == InputType::Controller; }
auto IsCurrentInputTypeKeyboardMouse() const { return GetCurrentInputType() == InputType::KeyboardMouse; }

public:
void ExclusiveMode(const bool exclusive);
bool IsExclusiveMode() const;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/UIDialogHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void CDialogHolder::OnFrame()
{
m_b_in_update = true;

if (GetUICursor().IsVisible() && pInput->GetCurrentInputType() == CInput::Controller)
if (GetUICursor().IsVisible() && pInput->IsCurrentInputTypeController())
GetUICursor().UpdateAutohideTiming();

CUIDialogWnd* wnd = TopInputReceiver();
Expand Down

0 comments on commit 9566601

Please sign in to comment.