MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetButtonState

Function GetButtonState

Source/Engine/Input/Gamepad.cpp:41–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 }
40
41 bool GetButtonState(const Gamepad::State& state, GamepadButton button, float deadZone)
42 {
43 if (deadZone > 0.01f)
44 {
45 switch (button)
46 {
47 case GamepadButton::LeftTrigger:
48 case GamepadButton::RightTrigger:
49 case GamepadButton::LeftStickUp:
50 case GamepadButton::LeftStickDown:
51 case GamepadButton::LeftStickLeft:
52 case GamepadButton::LeftStickRight:
53 case GamepadButton::RightStickUp:
54 case GamepadButton::RightStickDown:
55 case GamepadButton::RightStickLeft:
56 case GamepadButton::RightStickRight:
57 {
58 bool positive;
59 float axis = state.Axis[(int32)GetButtonAxis(button, positive)];
60 return positive ? axis >= deadZone : axis <= -deadZone;
61 }
62 default:
63 break;
64 }
65 }
66 return state.Buttons[(int32)button];
67 }
68}
69
70void GamepadLayout::Init()

Callers 3

GetButtonMethod · 0.85
GetButtonDownMethod · 0.85
GetButtonUpMethod · 0.85

Calls 1

GetButtonAxisFunction · 0.85

Tested by

no test coverage detected