Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of el17ajf by
Diff: Input/Input.cpp
- Revision:
- 10:5762d7fae033
- Parent:
- 9:3a7776a29a11
- Child:
- 12:beb0d7632531
--- a/Input/Input.cpp Fri Mar 15 20:30:01 2019 +0000
+++ b/Input/Input.cpp Fri Mar 15 21:16:39 2019 +0000
@@ -1,8 +1,10 @@
#include "Input.h"
+Input::State Input::states[NUMBER_OF_BUTTONS];
+
void Input::init() {
for (int i = 0; i < NUMBER_OF_BUTTONS; i++) {
- states[i] = RELEASED;
+ Input::states[i] = RELEASED;
}
}
@@ -13,11 +15,11 @@
void Input::update() {
// update existing states
for (int i = 0; i < NUMBER_OF_BUTTONS; i++) {
- if (states[i] == RELEASED_FRAME) {
- states[i] = RELEASED;
+ if (Input::states[i] == RELEASED_FRAME) {
+ Input::states[i] = RELEASED;
}
- if (states[i] == HIT_FRAME) {
- states[i] = HELD;
+ if (Input::states[i] == HIT_FRAME) {
+ Input::states[i] = HELD;
}
}
@@ -25,10 +27,10 @@
}
bool Input::buttonHit(Button button) {
- return states[button] == HIT_FRAME;
+ return Input::states[button] == HIT_FRAME;
}
bool Input::buttonHeld(Button button) {
- return states[button] == HIT_FRAME
- || states[button] == HELD;
+ return Input::states[button] == HIT_FRAME
+ || Input::states[button] == HELD;
}
\ No newline at end of file
