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
Input/Input.cpp
- Committer:
- el17ajf
- Date:
- 2019-03-15
- Revision:
- 9:3a7776a29a11
- Parent:
- 5:3efbdcb3efaf
- Child:
- 10:5762d7fae033
File content as of revision 9:3a7776a29a11:
#include "Input.h"
void Input::init() {
for (int i = 0; i < NUMBER_OF_BUTTONS; i++) {
states[i] = RELEASED;
}
}
void Input::deinit() {
}
void Input::update() {
// update existing states
for (int i = 0; i < NUMBER_OF_BUTTONS; i++) {
if (states[i] == RELEASED_FRAME) {
states[i] = RELEASED;
}
if (states[i] == HIT_FRAME) {
states[i] = HELD;
}
}
// check inputs
}
bool Input::buttonHit(Button button) {
return states[button] == HIT_FRAME;
}
bool Input::buttonHeld(Button button) {
return states[button] == HIT_FRAME
|| states[button] == HELD;
}
