Henry Triff
/
ELEC2645_Project_el18ht
Diff: Graphics/Graphics.cpp
- Revision:
- 26:f1d3b7e31091
- Parent:
- 25:31761087a83f
--- a/Graphics/Graphics.cpp Wed Apr 29 10:53:21 2020 +0000 +++ b/Graphics/Graphics.cpp Fri May 22 16:27:56 2020 +0000 @@ -12,249 +12,7 @@ // SPRITES //----------- -int logo[48][84] = { - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} -}; - -int flag[8][8] = { - {4,1,1,1,1,1,1,1}, - {4,1,1,0,1,0,1,1}, - {4,1,0,1,0,1,1,1}, - {4,1,1,0,1,0,1,1}, - {4,1,1,1,1,1,1,1}, - {4,4,4,4,4,4,1,1}, - {4,4,4,4,4,4,1,1}, - {4,4,4,4,4,4,1,1}, -}; - -//CARS - -int basic_car[8][8] = { - {4,4,4,4,4,4,4,4}, - {4,4,4,4,4,4,4,4}, - {4,4,1,1,1,1,4,4}, - {4,1,0,0,0,0,1,4}, - {4,1,0,0,0,0,1,4}, - {1,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1}, - {1,1,4,4,4,4,1,1}, - -}; - -int offroad_car[8][8] = { - {4,4,4,4,4,4,4,4}, - {4,1,1,1,1,1,1,4}, - {4,1,0,1,1,0,1,4}, - {4,1,1,0,0,1,1,4}, - {4,1,1,0,0,1,1,4}, - {1,1,0,1,1,0,1,1}, - {1,1,1,1,1,1,1,1}, - {1,1,4,4,4,4,1,1} -}; - -int drifter_car[8][8] = { - {4,4,4,4,4,4,4,4}, - {1,1,4,4,4,4,1,1}, - {4,4,1,1,1,1,4,4}, - {4,1,0,0,0,0,1,4}, - {4,1,0,0,0,0,1,4}, - {1,4,1,1,1,1,4,1}, - {1,1,1,1,1,1,1,1}, - {1,4,4,4,4,4,4,1}, - -}; - -int sports_car[8][8] = { - {4,4,4,4,4,4,4,4}, - {4,4,4,4,4,4,4,4}, - {4,4,4,4,4,4,4,4}, - {1,1,4,4,4,4,1,1}, - {4,4,1,1,1,1,4,4}, - {4,1,0,0,0,0,1,4}, - {1,1,1,1,1,1,1,1}, - {1,1,4,4,4,4,1,1}, - -}; - -int race_car[8][8] = { - {4,4,4,4,4,4,4,4}, - {4,4,4,4,4,4,4,4}, - {4,1,1,1,1,1,1,4}, - {4,4,4,1,1,4,4,4}, - {4,4,4,1,1,4,4,4}, - {1,4,1,1,1,1,4,1}, - {1,1,1,0,0,1,1,1}, - {1,4,1,1,1,1,4,1}, -}; - -int stupid_car[8][8] = { - {4,4,4,4,4,4,4,4}, - {4,4,4,1,1,4,4,4}, - {4,4,1,0,0,1,4,4}, - {4,1,1,0,0,1,1,4}, - {1,0,1,1,1,1,0,1}, - {1,0,0,0,0,0,0,1}, - {4,1,1,1,1,1,1,4}, - {4,4,4,4,4,4,4,4} -}; - -int ghost[8][8] = { - {0,0,4,4,4,4,0,0}, - {0,1,0,4,4,0,1,0}, - {4,0,1,0,0,1,0,4}, - {4,4,0,1,1,0,4,4}, - {4,4,0,1,1,0,4,4}, - {4,0,1,0,0,1,0,4}, - {0,1,0,4,4,0,1,0}, - {0,0,4,4,4,4,0,0}, -}; - -int count_down_3[17][17] = { - {4,4,4,4,0,0,0,0,0,0,0,4,4,4,4,4,4}, - {4,4,4,0,1,1,1,1,1,1,1,0,4,4,4,4,4}, - {4,4,0,1,1,1,1,1,1,1,1,1,0,4,4,4,4}, - {4,0,1,1,1,1,1,1,1,1,1,1,1,0,4,4,4}, - {4,0,1,1,1,1,0,0,0,0,1,1,1,1,0,4,4}, - {4,0,1,1,1,0,4,4,4,4,0,1,1,1,0,4,4}, - {4,0,1,1,1,0,4,4,0,0,1,1,1,1,0,4,4}, - {4,4,0,0,0,4,4,0,1,1,1,1,1,0,4,4,4}, - {4,4,4,4,4,4,4,0,1,1,1,1,0,4,4,4,4}, - {4,4,0,0,0,4,4,0,1,1,1,1,1,0,4,4,4}, - {4,0,1,1,1,0,4,4,0,0,1,1,1,1,0,4,4}, - {4,0,1,1,1,0,4,4,4,4,0,1,1,1,0,4,4}, - {4,0,1,1,1,1,0,0,0,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0,1,1,1,0}, - {4,4,4,4,4,4,4,4,4,0,1,1,1,1,1,1,0,4}, - {4,4,4,4,4,4,4,4,4,4,0,1,1,1,1,0,4,4}, - {4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4,4,4}, -}; - -int cup[16][16] = { - {4,4,4,4,4,0,0,0,0,0,0,4,4,4,4,4}, - {4,0,0,0,0,1,1,1,1,1,1,0,0,0,0,4}, - {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, - {0,1,0,0,0,1,1,0,1,1,1,0,0,0,1,0}, - {0,1,0,0,0,1,1,0,0,1,1,0,0,0,1,0}, - {4,0,1,0,0,1,1,0,0,1,1,0,0,1,0,4}, - {4,0,1,0,0,1,1,0,0,1,1,0,0,1,0,4}, - {4,4,0,1,0,1,1,0,0,1,1,0,1,0,4,4}, - {4,4,0,1,0,1,1,1,0,1,1,0,1,0,4,4}, - {4,4,4,0,1,1,1,1,1,1,1,1,0,4,4,4}, - {4,4,4,4,0,0,1,1,1,1,0,0,4,4,4,4}, - {4,4,4,4,4,4,0,1,1,0,4,4,4,4,4,4}, - {4,4,4,4,4,4,0,1,1,0,4,4,4,4,4,4}, - {4,4,4,4,4,0,1,1,1,1,0,4,4,4,4,4}, - {4,4,4,4,0,1,1,1,1,1,1,0,4,4,4,4}, - {4,4,4,4,4,0,0,0,0,0,0,4,4,4,4,4}, -}; +#include "Sprites.h" //-------------------------- // MAIN GRAPHICS FUNCTION @@ -263,13 +21,13 @@ // It is a LARGE function but it reduces the clutter in main.cpp // This is run once every frame. -void Graphics::Draw_Map(Point_2D translation, int angle, float squish, float horizon_factor, Line_2D *Track_Lines, Line_2D *Track_Dotted_Lines, Line_2D *Track_Walls, Point_2D *Track_Flags, Triangle_2D *Track_Boost_Plates, Map_Data map_info, int car_type, Point_2D ghost_position, N5110 &LCD) +void Graphics::Draw_Map(Point_2D translation, int angle, float squish, float horizon_factor, Line_2D *Track_Lines, Line_2D *Track_Dotted_Lines, Line_2D *Track_Walls, Sprite_2D *Track_Sprites, Triangle_2D *Track_Boost_Plates, Map_Data map_info, int car_type, Point_2D ghost_position, N5110 &LCD) { //Variable declaration enum cars {Basic, Offroad, Drifter, Sportscar, Racecar, Stupid}; Line_2D Track_Lines_Transformed[map_info.number_of_track_lines]; Line_2D Track_Dotted_Lines_Transformed[map_info.number_of_dotted_lines]; - Point_2D Transformed_Flags[map_info.number_of_flags]; + Point_2D Transformed_Sprites[map_info.number_of_sprites]; Line_2D Transformed_Walls[map_info.number_of_walls]; Point_2D Transformed_Ghost; @@ -308,16 +66,17 @@ } //Transforms the points of the start flags - for(int i = 0; i < map_info.number_of_flags; i++) { //Iterates through the given flags array - Transformed_Flags[i] = Track_Flags[i]; + for(int i = 0; i < map_info.number_of_sprites; i++) { //Iterates through the given flags array + Transformed_Sprites[i].x = Track_Sprites[i].x; + Transformed_Sprites[i].y = Track_Sprites[i].y; //Translation - Transformed_Flags[i] = Translate_Point(Transformed_Flags[i], Round(translation.x), Round(translation.y)); + Transformed_Sprites[i] = Translate_Point(Transformed_Sprites[i], Round(translation.x), Round(translation.y)); //Rotation - Transformed_Flags[i] = Rotate_Point(Transformed_Flags[i], angle); + Transformed_Sprites[i] = Rotate_Point(Transformed_Sprites[i], angle); //Horizon - Transformed_Flags[i] = Horizon_Point(Transformed_Flags[i], horizon_factor); + Transformed_Sprites[i] = Horizon_Point(Transformed_Sprites[i], horizon_factor); //Squish - Transformed_Flags[i] = Squish_Point(Transformed_Flags[i], squish); + Transformed_Sprites[i] = Squish_Point(Transformed_Sprites[i], squish); } //Transforms the points of the walls @@ -364,11 +123,6 @@ Graphics_Draw_Boost_Plate(Track_Boost_Plates[i], translation, angle, squish, LCD); } - //Draws the flags - for(int i = 0; i < map_info.number_of_flags; i++) { //Iterates through each flag - Graphics_Draw_Sprite(Transformed_Flags[i], 8, 8, (int *)flag, LCD); - } - //Draws the ghost Graphics_Draw_Sprite(Transformed_Ghost, 8, 8, (int *)ghost, LCD); @@ -376,9 +130,24 @@ for(int i = 0; i < map_info.number_of_walls; i++) { Graphics_Draw_Wall(Transformed_Walls[i].from, Transformed_Walls[i].to,4, LCD); } + + //Draws the flags + for(int i = 0; i < map_info.number_of_sprites; i++) { //Iterates through each flag + if(Track_Sprites[i].type == Flag) { + Graphics_Draw_Sprite(Transformed_Sprites[i], 8, 8, (int *)flag, LCD); + } else if(Track_Sprites[i].type == Helicopter) { + Graphics_Draw_Sprite(Transformed_Sprites[i], 48, 24, (int *)helicopter, LCD); + } else if(Track_Sprites[i].type == People_Cheering) { + Graphics_Draw_Sprite(Transformed_Sprites[i], 8, 12, (int *)person_cheering, LCD); + } else if(Track_Sprites[i].type == People_Standing_1) { + Graphics_Draw_Sprite(Transformed_Sprites[i], 6, 12, (int *)person_standing_1, LCD); + } else if(Track_Sprites[i].type == People_Standing_2) { + Graphics_Draw_Sprite(Transformed_Sprites[i], 6, 12, (int *)person_standing_2, LCD); + } + } //Draws the players car - Point_2D car_position = {4,0}; + Point_2D car_position = {0,0}; if(car_type == Stupid) { Graphics_Draw_Sprite(car_position,8,8,(int *)stupid_car, LCD); } else if(car_type == Racecar) { @@ -422,7 +191,7 @@ //START void Graphics::Start_Sequence(int state, N5110 &LCD) //Display the countdown numbers before the race starts { - Point_2D count_down_position = {8,8}; + Point_2D count_down_position = {0,8}; if(state == 3) { Graphics_Draw_Sprite(count_down_position, 17, 17, (int *) count_down_3, LCD); } else if(state == 2) { @@ -438,7 +207,7 @@ //FINISH void Graphics::Finish(N5110 &LCD) //When the race is over draw the cup symbol { - Point_2D finish_position = {8,8}; + Point_2D finish_position = {0,8}; Graphics_Draw_Sprite(finish_position, 16, 16, (int *) cup, LCD); } @@ -701,14 +470,15 @@ void Graphics::Graphics_Draw_Sprite(Point_2D point, int x_size, int y_size, int *sprite, N5110 &LCD) //Similar to N5110 drawSprite function but mine uses the origin as poin 0,0 and allows for transparent pixels { - Point_2D zeroed_point = {Round(point.x) + 42 - x_size, Round(-point.y) + 36 - y_size}; - if(zeroed_point.x <= 84 && zeroed_point.x >= 0 && zeroed_point.y <= 48 && zeroed_point.y >= 0) { //If the point is on the screen - for(int y = 0; y < y_size; y++) { //Iterates through y-points - for(int x = 0; x < x_size; x++) { //Iterates through x-points - if(*((sprite + y*y_size)+x) == 1) { //If the sprite has a 1 at that point then set that pixel to black - LCD.setPixel((zeroed_point.x + x), (zeroed_point.y + y), true); - } else if(*((sprite + y*y_size)+x) == 0) { //If the sprite has a 0 at that point then set that pixel to white - LCD.setPixel((zeroed_point.x + x), (zeroed_point.y + y), false); + Point_2D zeroed_point = {Round(point.x) + 42 - (x_size / 2), Round(-point.y) + 36 - y_size}; + for (int i = 0; i < y_size; i++) { + for (int j = 0 ; j < x_size ; j++) { + int pixel = *((sprite+i*x_size)+j); + if(pixel == 1 || pixel == 0) { + int x = zeroed_point.x+j; + int y = zeroed_point.y+i; + if(x <= 84 && x >= 0 && y <= 48 && y >= 0) { //If the point is on the screen + LCD.setPixel(x,y, pixel); } } }