MCPcopy Create free account
hub / github.com/EasyRPG/Player / UpdateButton

Function UpdateButton

src/input.cpp:91–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91static void UpdateButton(int i, bool pressed) {
92 using namespace Input;
93
94 if (pressed) {
95 released[i] = false;
96 press_time[i] += 1;
97 } else {
98 released[i] = press_time[i] > 0;
99 press_time[i] = 0;
100 }
101
102 if (press_time[i] > 0) {
103 triggered[i] = press_time[i] == 1;
104 repeated[i] = press_time[i] == 1 || (press_time[i] >= start_repeat_time && press_time[i] % repeat_time == 0);
105 } else {
106 triggered[i] = false;
107 repeated[i] = false;
108 }
109}
110
111void Input::Update() {
112 wait_input = false; // clear each frame

Callers 3

UpdateMethod · 0.85
UpdateSystemMethod · 0.85
SimulateButtonPressMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected