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.
Graphics/Graphics.h
- Committer:
- HenryWTriff
- Date:
- 2020-02-11
- Revision:
- 3:ceed6d026b8b
- Parent:
- 2:d08b6a1eaf2b
- Child:
- 5:2d9f3c36bcb9
File content as of revision 3:ceed6d026b8b:
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "Graphics.h"
#include "Controls.h"
#ifndef STRUCTS
#define STRUCTS
//STRUCTS
struct Point_2D {
float x;
float y;
};
struct Line_2D {
Point_2D from;
Point_2D to;
};
struct Map_Data {
int number_of_track_lines;
int number_of_dotted_lines;
int number_of_flags;
};
#endif
class Graphics
{
public:
//SCREEN SETTINGS
void Change_Contrast(N5110 &LCD, Gamepad &Device);
//GRAPHICS
void Draw_Map(int game_fps, Point_2D translation, int angle, float squish, Line_2D *Track_Lines, Line_2D *Track_Dotted_Lines, Point_2D *Track_Flags, Map_Data map_info, N5110 &LCD);
private:
//TRANSFORM
Point_2D Rotate_Point(Point_2D point, float angle);
Point_2D Translate_Point(Point_2D point, int translate_x, int translate_y);
Point_2D Squish_Point(Point_2D point, float squish);
//MATH
int Round(float number);
float Gradient(Point_2D from, Point_2D to);
bool Gradient_Check_Infinate(Point_2D from, Point_2D to);
//DRAW
void Graphics_Draw_Line(Point_2D from, Point_2D to, bool solid, N5110 &LCD);
void Graphics_Draw_Sprite(Point_2D point, int x_size, int y_size, int *sprite, N5110 &LCD);
};
#endif