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:
- 12:beb0d7632531
- Parent:
- 10:5762d7fae033
- Child:
- 13:59e17cab320a
--- a/Input/Input.cpp Sun Mar 17 10:55:11 2019 +0000
+++ b/Input/Input.cpp Sun Mar 17 12:14:56 2019 +0000
@@ -1,15 +1,24 @@
#include "Input.h"
+#include "mbed.h" // TODO DELETE
+
+const int NUMBER_OF_BUTTONS = 4;
Input::State Input::states[NUMBER_OF_BUTTONS];
+Gamepad * Input::gamepad;
void Input::init() {
- for (int i = 0; i < NUMBER_OF_BUTTONS; i++) {
+ gamepad = new Gamepad();
+ gamepad->init();
+ //printf("%d\n", NUMBER_OF_BUTTONS);
+ /*
+ for (int i = 0; i < 4; i++) {
Input::states[i] = RELEASED;
}
+ */
}
void Input::deinit() {
-
+ delete gamepad;
}
void Input::update() {
@@ -24,6 +33,10 @@
}
// check inputs
+ if (gamepad->check_event(Gamepad::Y_PRESSED)) {
+// states[RIGHT] = HIT_FRAME;
+ printf("RIGHT\n");
+ }
}
bool Input::buttonHit(Button button) {
