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.
Revision 28:bd21eff0a18a, committed 2020-05-22
- Comitter:
- JoeShotton
- Date:
- Fri May 22 17:23:20 2020 +0000
- Parent:
- 27:68cc4ef820f4
- Commit message:
- Basic snake movement implemented with FSM
Changed in this revision
Gamepad.cpp | Show annotated file Show diff for this revision Revisions of this file |
Gamepad.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Gamepad.cpp Wed May 20 21:25:11 2020 +0000 +++ b/Gamepad.cpp Fri May 22 17:23:20 2020 +0000 @@ -196,29 +196,6 @@ return d; } -int Gamepad::get_cardinal() -{ - float angle = get_angle(); // 0 to 360, -1 for centred - - int d = 0; - // partition 360 into segments and check which segment the angle is in - if (angle < 0.0f) { - d = 0; // check for -1.0 angle - } else if (angle < 22.5f) { // then keep going in 45 degree increments - d = 1; - } else if (angle < 112.5f) { - d = 2; - } else if (angle < 202.5f) { - d = 3; - } else if (angle < 292.5f) { - d = 4; - } else { - d = 1; - } - - return d; -} - void Gamepad::reset_buttons() { A_fall = B_fall = X_fall = Y_fall = start_fall = false;
--- a/Gamepad.h Wed May 20 21:25:11 2020 +0000 +++ b/Gamepad.h Fri May 22 17:23:20 2020 +0000 @@ -145,11 +145,6 @@ */ Direction get_direction(); // N,NE,E,SE etc. - /** CUSTOM: Gets joystick cardinal direction - * @returns an integer, 0 for centre, 1 - 4 for NESW respectively - */ - int get_cardinal(); - /** Gets raw cartesian co-ordinates of joystick * @returns a struct with x,y members, each in the range 0.0 to 1.0 */