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.
Ghost/Ghost.h
- Committer:
- HenryWTriff
- Date:
- 2020-03-28
- Revision:
- 11:7b12992156de
- Parent:
- 10:29126a41b1da
- Child:
- 16:17f91f51358f
File content as of revision 11:7b12992156de:
#ifndef GHOST_H #define GHOST_H #include "mbed.h" #include "Gamepad.h" #include "N5110.h" #include "FXOS8700CQ.h" #include "SDFileSystem.h" #include "Graphics.h" #include "Mechanics.h" #include "Menu.h" #include "LEDs.h" #include "Ghost.h" #include <string> #ifndef STRUCTS #define STRUCTS //STRUCTS struct Point_2D { float x; float y; }; struct Line_2D { Point_2D from; Point_2D to; }; struct Square_2D { Point_2D TL; Point_2D BR; }; struct Triangle_2D { Point_2D TL; Point_2D BR; int Type; }; struct Map_Data { int number_of_track_lines; int number_of_dotted_lines; int number_of_flags; int number_of_walls; int number_of_off_track_squares; int number_of_off_track_triangles; int number_of_out_of_bounds_squares; int number_of_out_of_bounds_triangles; int number_of_gates; int number_of_boost_plates; }; struct Time { int mins; int secs; int milis; }; struct Gyro_Data { float ax; float ay; float az; float mx; float my; float mz; }; #endif static Point_2D Ghost_Data[6000]; static int Ghost_Held_Data_Time = 0; static Point_2D Ghost_Held_Data[6000]; #ifndef ENUMS #define ENUMS enum track {Small, Medium, Large}; enum cars {Basic, Offroad, Drifter, Sportscar, Racecar, Stupid}; #endif class Ghost { public: void Record(Point_2D position, int race_time); void Copy(int race_time, int track, int car, SDFileSystem &SD); Point_2D Play(bool ghost_available, int race_time); bool SD_init(SDFileSystem &SD); void SD_Write(int track, int car, int race_time, SDFileSystem &SD); void SD_Read(int track, int car, SDFileSystem &SD); void SD_Write_Data(string name, int race_time, SDFileSystem &SD); void SD_Write_Time(int track, int car, int race_time, SDFileSystem &SD); void SD_Read_Data(string name, int race_time, SDFileSystem &SD); void SD_Read_Time(int track, int car, SDFileSystem &SD); int SD_Get_Time(int track, int car, SDFileSystem &SD); private: }; #endif