AMFP Enhanced
C++ reference: the code this unofficial fork added
Toggle main menu visibility
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
8
inline
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. */
16
inline
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. */
24
inline
bool
LuxStickActive
(
float
afValue)
25
{
26
return
afValue > 0.5f || afValue < -0.5f;
27
}
28
29
#endif
LuxStickActive
bool LuxStickActive(float afValue)
Stick deflection beyond the dead zone counts as gamepad use.
Definition
LuxInputMode.h:24
LuxInputModeOnPadChange
bool LuxInputModeOnPadChange(bool abGamepadMode, bool abHadPad, bool abHasPad)
A controller appearing (at start or plugged in) switches to gamepad mode; losing it switches back.
Definition
LuxInputMode.h:16
LuxNextInputMode
bool LuxNextInputMode(bool abGamepadMode, bool abPadActivity, bool abKbmActivity)
Definition
LuxInputMode.h:8
Game
src
game
LuxInputMode.h
Generated by
1.18.0