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 el17dg by
Diff: menu/menu.cpp
- Revision:
- 24:0570cb4b92d7
- Parent:
- 19:b78fa41d04a9
- Child:
- 26:676874c42883
--- a/menu/menu.cpp Sun Mar 31 01:04:59 2019 +0000
+++ b/menu/menu.cpp Tue Apr 02 15:38:40 2019 +0000
@@ -1,5 +1,6 @@
#include "main.h"
#include "menu.h"
+#include "constants.h"
const int total_options = 3;
const float time_delay = 100;
@@ -21,11 +22,11 @@
bool Menu::updateAndDraw() { // cheking whether the joystick was moved to point at other options in the menu.
- if(y_dir.read() > 0.6f){
+ if(y_dir.read() > joy_threshold_max_y){
current_option -= 1;
wait_ms(time_delay);
}
- else if (y_dir.read() < 0.4f){
+ else if (y_dir.read() < joy_threshold_min_y){
current_option += 1;
wait_ms(time_delay);
}
@@ -38,9 +39,9 @@
drawPointer(); // Drawing pointer only ones.
- lcd.printString(" Start Game",1,2);
- lcd.printString(" Tutorial",1,3);
- lcd.printString(" Settings",1,4);
+ lcd.printString("Start Game",1,2);
+ lcd.printString("Tutorial",1,3);
+ lcd.printString("Settings",1,4);
bool option_picked = false; // Checking for the selecting button to be pressed and returning the boolean statement.
if (gamepad.check_event(gamepad.A_PRESSED)){
