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.
Diff: Mechanics/Mechanics.h
- Revision:
- 7:2ce6e90f6d47
- Parent:
- 6:5f76dd718dc3
- Child:
- 9:7b1093d3f03a
--- a/Mechanics/Mechanics.h Wed Feb 19 21:40:21 2020 +0000 +++ b/Mechanics/Mechanics.h Sat Feb 22 23:13:25 2020 +0000 @@ -6,7 +6,6 @@ #include "N5110.h" #include "FXOS8700CQ.h" #include "Graphics.h" -#include "Controls.h" #include "Mechanics.h" #include "Menu.h" #include "LEDs.h" @@ -64,24 +63,55 @@ float mz; }; +struct Menu_Data { + int Menu_return; + bool Back; +}; + #endif class Mechanics { public: - bool Is_Offtrack(Point_2D position, Square_2D offtrack_square[], Triangle_2D offtrack_triangle[], Map_Data map_info); - bool Is_Out_Of_Bounds(Point_2D position, Square_2D offtrack_square[], Triangle_2D offtrack_triangle[], Map_Data map_info); int Get_Gate(Square_2D gates[], int number_of_gates, Point_2D position, int current_gate); int Get_Laps(int laps, Square_2D gates[], int number_of_gates, Point_2D position, int current_gate); + Time Convert_To_Time(int game_fps, int number_of_frames); - float Get_Boost_Speed(Triangle_2D plates[], int number_of_plates, Point_2D position, float speed); - + int Get_Angle(int angle, int handling, bool gyro_enabled, FXOS8700CQ &Gyro, Gamepad &Device); + Point_2D Get_Translation(Point_2D in, float angle, float speed, Square_2D *out_of_bounds_square, Triangle_2D *out_of_bounds_triangle, Map_Data map_info, Gamepad &Device); + + float Get_Speed( + float speed, + float max_speed, + float acceleration, + float deceleration, + float off_track_speed, + Point_2D position, + Square_2D *offtrack_square, + Triangle_2D *offtrack_triangle, + Square_2D *out_of_bounds_square, + Triangle_2D *out_of_bounds_triangle, + Triangle_2D *plates, + Map_Data map_info, + Gamepad &Device + ); + + float Get_Max_Speed(int car_model); + float Get_Acceleration(int car_model); + float Get_Deceleration(int car_model); + float Get_Off_Road_Speed(int car_model); + int Get_Handling(int car_model); + private: + //SPEED + bool Is_Offtrack(Point_2D position, Square_2D offtrack_square[], Triangle_2D offtrack_triangle[], Map_Data map_info); + bool Is_Out_Of_Bounds(Point_2D position, Square_2D offtrack_square[], Triangle_2D offtrack_triangle[], Map_Data map_info); bool Is_Offtrack_Square(Square_2D offtrack[], int size, Point_2D position); bool Is_Offtrack_Triangle(Triangle_2D offtrack[], int size, Point_2D position); bool Is_Out_Of_Bounds_Square(Square_2D out_of_bounds[], int size, Point_2D position); bool Is_Out_Of_Bounds_Triangle(Triangle_2D out_of_bounds[], int size, Point_2D position); - + float Get_Boost_Speed(Triangle_2D plates[], int number_of_plates, Point_2D position, float speed); + }; #endif \ No newline at end of file