AMFP Enhanced
C++ reference: the code this unofficial fork added
Loading...
Searching...
No Matches
LuxInputMode.h
Go to the documentation of this file.
1/*
2 * AMFP-2026: which input the player used last (gamepad or keyboard/mouse), so prompts and
3 * dialogs show matching buttons. Unit tested in tests/cpp/test_input_mode.cpp.
4 */
5#ifndef LUX_INPUT_MODE_H
6#define LUX_INPUT_MODE_H
7
8inline bool LuxNextInputMode(bool abGamepadMode, bool abPadActivity, bool abKbmActivity)
9{
10 if(abPadActivity) return true; // the pad wins a tie: a resting hand on the mouse jitters
11 if(abKbmActivity) return false;
12 return abGamepadMode;
13}
14
15/** A controller appearing (at start or plugged in) switches to gamepad mode; losing it switches back. */
16inline bool LuxInputModeOnPadChange(bool abGamepadMode, bool abHadPad, bool abHasPad)
17{
18 if(abHasPad && !abHadPad) return true;
19 if(abHadPad && !abHasPad) return false;
20 return abGamepadMode;
21}
22
23/** Stick deflection beyond the dead zone counts as gamepad use. */
24inline bool LuxStickActive(float afValue)
25{
26 return afValue > 0.5f || afValue < -0.5f;
27}
28
29#endif
bool LuxStickActive(float afValue)
Stick deflection beyond the dead zone counts as gamepad use.
bool LuxInputModeOnPadChange(bool abGamepadMode, bool abHadPad, bool abHasPad)
A controller appearing (at start or plugged in) switches to gamepad mode; losing it switches back.
bool LuxNextInputMode(bool abGamepadMode, bool abPadActivity, bool abKbmActivity)
Definition LuxInputMode.h:8