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.
Dependencies: mbed
GraphicEngine/GraphicEngine.h@60:e1ac7fa5cf17, 2020-05-27 (annotated)
- Committer:
- el19tb
- Date:
- Wed May 27 01:21:19 2020 +0000
- Revision:
- 60:e1ac7fa5cf17
- Parent:
- 56:2797166656e0
- Child:
- 61:3714af9caab6
created the doygen for all classes API, described each function in every class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el19tb | 3:648c9d5001be | 1 | #ifndef GRAPHICENGINE_H |
el19tb | 3:648c9d5001be | 2 | #define GRAPHICENGINE_H |
el19tb | 3:648c9d5001be | 3 | |
el19tb | 42:04e326dcf09b | 4 | #include "Frog.h" |
el19tb | 42:04e326dcf09b | 5 | #include "Object.h" |
el19tb | 43:2cd1cfe07770 | 6 | #include "Vehicle.h" |
el19tb | 43:2cd1cfe07770 | 7 | #include "WaterSprites.h" |
el19tb | 44:f02510eeb165 | 8 | #include "Background.h" |
el19tb | 44:f02510eeb165 | 9 | #include "Frogger.h" |
el19tb | 3:648c9d5001be | 10 | |
el19tb | 3:648c9d5001be | 11 | #include "mbed.h" |
el19tb | 3:648c9d5001be | 12 | #include "N5110.h" |
el19tb | 3:648c9d5001be | 13 | #include "Gamepad.h" |
el19tb | 4:aae7f8d4ab78 | 14 | #include <vector> |
el19tb | 3:648c9d5001be | 15 | |
el19tb | 60:e1ac7fa5cf17 | 16 | /** Graphicengine Class |
el19tb | 60:e1ac7fa5cf17 | 17 | * @brief displays objects to lcd, stores all the graphical objects |
el19tb | 60:e1ac7fa5cf17 | 18 | * @author Tarek Bessalah |
el19tb | 60:e1ac7fa5cf17 | 19 | * @date May, 2020 |
el19tb | 60:e1ac7fa5cf17 | 20 | */ |
el19tb | 42:04e326dcf09b | 21 | class GraphicEngine |
el19tb | 42:04e326dcf09b | 22 | { |
el19tb | 5:6e3afee7eac3 | 23 | public: |
el19tb | 60:e1ac7fa5cf17 | 24 | |
el19tb | 60:e1ac7fa5cf17 | 25 | /** Constructor |
el19tb | 60:e1ac7fa5cf17 | 26 | * @param the lcd object to draw on |
el19tb | 60:e1ac7fa5cf17 | 27 | */ |
el19tb | 44:f02510eeb165 | 28 | GraphicEngine(); |
el19tb | 60:e1ac7fa5cf17 | 29 | |
el19tb | 60:e1ac7fa5cf17 | 30 | /** |
el19tb | 60:e1ac7fa5cf17 | 31 | * @param this is the physical lcd object, that the user is looking at |
el19tb | 60:e1ac7fa5cf17 | 32 | */ |
el19tb | 5:6e3afee7eac3 | 33 | N5110 lcd; |
el19tb | 42:04e326dcf09b | 34 | |
el19tb | 42:04e326dcf09b | 35 | public: |
el19tb | 5:6e3afee7eac3 | 36 | |
el19tb | 60:e1ac7fa5cf17 | 37 | /** |
el19tb | 60:e1ac7fa5cf17 | 38 | * @param initiailized the lcd object |
el19tb | 60:e1ac7fa5cf17 | 39 | */ |
el19tb | 42:04e326dcf09b | 40 | void init(); |
el19tb | 42:04e326dcf09b | 41 | |
el19tb | 60:e1ac7fa5cf17 | 42 | /** |
el19tb | 60:e1ac7fa5cf17 | 43 | * @param clears the current screen |
el19tb | 60:e1ac7fa5cf17 | 44 | */ |
el19tb | 5:6e3afee7eac3 | 45 | void clear(); |
el19tb | 5:6e3afee7eac3 | 46 | |
el19tb | 60:e1ac7fa5cf17 | 47 | /** |
el19tb | 60:e1ac7fa5cf17 | 48 | * @param refreshes the screen |
el19tb | 60:e1ac7fa5cf17 | 49 | */ |
el19tb | 5:6e3afee7eac3 | 50 | void refresh(); |
el19tb | 5:6e3afee7eac3 | 51 | |
el19tb | 60:e1ac7fa5cf17 | 52 | /** |
el19tb | 60:e1ac7fa5cf17 | 53 | * @param sets the contrast to a fixed value of 0.45 |
el19tb | 60:e1ac7fa5cf17 | 54 | */ |
el19tb | 5:6e3afee7eac3 | 55 | void contrast(); |
el19tb | 5:6e3afee7eac3 | 56 | |
el19tb | 60:e1ac7fa5cf17 | 57 | /** |
el19tb | 60:e1ac7fa5cf17 | 58 | * @param turns on the the backlight on |
el19tb | 60:e1ac7fa5cf17 | 59 | */ |
el19tb | 5:6e3afee7eac3 | 60 | void backLightOn(); |
el19tb | 60:e1ac7fa5cf17 | 61 | |
el19tb | 60:e1ac7fa5cf17 | 62 | /** |
el19tb | 60:e1ac7fa5cf17 | 63 | * @param testing object used to print to the screen |
el19tb | 60:e1ac7fa5cf17 | 64 | */ |
el19tb | 5:6e3afee7eac3 | 65 | void printTest(); |
el19tb | 60:e1ac7fa5cf17 | 66 | |
el19tb | 60:e1ac7fa5cf17 | 67 | /** |
el19tb | 60:e1ac7fa5cf17 | 68 | * @param prints the loser text to the screen |
el19tb | 60:e1ac7fa5cf17 | 69 | */ |
el19tb | 40:8cc82e3fce06 | 70 | void printLoser(); |
el19tb | 60:e1ac7fa5cf17 | 71 | |
el19tb | 60:e1ac7fa5cf17 | 72 | /** |
el19tb | 60:e1ac7fa5cf17 | 73 | * @param prints squished message to the lcd |
el19tb | 60:e1ac7fa5cf17 | 74 | */ |
el19tb | 42:04e326dcf09b | 75 | void print(); |
el19tb | 60:e1ac7fa5cf17 | 76 | |
el19tb | 60:e1ac7fa5cf17 | 77 | /** |
el19tb | 60:e1ac7fa5cf17 | 78 | * @param draws the danger zone at the top |
el19tb | 60:e1ac7fa5cf17 | 79 | */ |
el19tb | 49:6cad8b6ec5f2 | 80 | void drawDangerZone(); |
el19tb | 60:e1ac7fa5cf17 | 81 | |
el19tb | 60:e1ac7fa5cf17 | 82 | /** |
el19tb | 60:e1ac7fa5cf17 | 83 | * @param draws the menu to the screen |
el19tb | 60:e1ac7fa5cf17 | 84 | */ |
el19tb | 50:9ffeb4a10c0a | 85 | void drawMenu(); |
el19tb | 60:e1ac7fa5cf17 | 86 | |
el19tb | 60:e1ac7fa5cf17 | 87 | /** |
el19tb | 60:e1ac7fa5cf17 | 88 | * @param based on the pointer, it uses a switch statement to draw it |
el19tb | 60:e1ac7fa5cf17 | 89 | * @param sel- the number of rows |
el19tb | 60:e1ac7fa5cf17 | 90 | */ |
el19tb | 50:9ffeb4a10c0a | 91 | void getPointerPos(int sel); |
el19tb | 60:e1ac7fa5cf17 | 92 | |
el19tb | 60:e1ac7fa5cf17 | 93 | /** |
el19tb | 60:e1ac7fa5cf17 | 94 | * @param display the frog based on the x, y, height, and animation |
el19tb | 60:e1ac7fa5cf17 | 95 | * @param x - x pos of frog |
el19tb | 60:e1ac7fa5cf17 | 96 | * @param y - y of the frog |
el19tb | 60:e1ac7fa5cf17 | 97 | * @param width - width of frog |
el19tb | 60:e1ac7fa5cf17 | 98 | * @param height - height of frog |
el19tb | 60:e1ac7fa5cf17 | 99 | * @param state - current animation of the frog |
el19tb | 60:e1ac7fa5cf17 | 100 | */ |
el19tb | 47:29c4796a49e5 | 101 | void showFrog(float x, int y, int width, int height, int state); |
el19tb | 60:e1ac7fa5cf17 | 102 | |
el19tb | 60:e1ac7fa5cf17 | 103 | /** |
el19tb | 60:e1ac7fa5cf17 | 104 | * @param draws the black rectangles for bonus rounds |
el19tb | 60:e1ac7fa5cf17 | 105 | */ |
el19tb | 53:b6bb4dab7823 | 106 | void drawVoidBackGround(); |
el19tb | 60:e1ac7fa5cf17 | 107 | |
el19tb | 60:e1ac7fa5cf17 | 108 | /** |
el19tb | 60:e1ac7fa5cf17 | 109 | * @param draws the goal post in the lcd, has the sprite object already saved |
el19tb | 60:e1ac7fa5cf17 | 110 | * @param x - x pos of the goal post |
el19tb | 60:e1ac7fa5cf17 | 111 | */ |
el19tb | 50:9ffeb4a10c0a | 112 | void drawEndPost(int x); |
el19tb | 60:e1ac7fa5cf17 | 113 | |
el19tb | 60:e1ac7fa5cf17 | 114 | /** |
el19tb | 60:e1ac7fa5cf17 | 115 | * @param prints congratulations whenever the frog succeeds |
el19tb | 60:e1ac7fa5cf17 | 116 | */ |
el19tb | 50:9ffeb4a10c0a | 117 | void printCongrats(); |
el19tb | 60:e1ac7fa5cf17 | 118 | |
el19tb | 60:e1ac7fa5cf17 | 119 | /** |
el19tb | 60:e1ac7fa5cf17 | 120 | * @param displays the vehicle objects of the bonus rounds |
el19tb | 60:e1ac7fa5cf17 | 121 | * @param x - the x pos of the vehicle |
el19tb | 60:e1ac7fa5cf17 | 122 | * @param y - the y pos of the vehicle |
el19tb | 60:e1ac7fa5cf17 | 123 | * @param c - the sprite of the vehicle |
el19tb | 60:e1ac7fa5cf17 | 124 | */ |
el19tb | 53:b6bb4dab7823 | 125 | void displayBonusObjects(int x, int y, char c); |
el19tb | 60:e1ac7fa5cf17 | 126 | |
el19tb | 60:e1ac7fa5cf17 | 127 | /** |
el19tb | 60:e1ac7fa5cf17 | 128 | * @param shows the object to the screen |
el19tb | 60:e1ac7fa5cf17 | 129 | * @param obj pointer - used to access the rectangle parameters of the vehicle |
el19tb | 60:e1ac7fa5cf17 | 130 | * @param state - the state of the turtle to detemine what turtle sprite to draw |
el19tb | 60:e1ac7fa5cf17 | 131 | */ |
el19tb | 52:1145e99264ea | 132 | void showObj(Object *obj, int state); |
el19tb | 44:f02510eeb165 | 133 | |
el19tb | 60:e1ac7fa5cf17 | 134 | /** |
el19tb | 60:e1ac7fa5cf17 | 135 | * @param displays the intro of a new level part b |
el19tb | 60:e1ac7fa5cf17 | 136 | */ |
el19tb | 50:9ffeb4a10c0a | 137 | void newLevel1(); |
el19tb | 60:e1ac7fa5cf17 | 138 | |
el19tb | 60:e1ac7fa5cf17 | 139 | /** |
el19tb | 60:e1ac7fa5cf17 | 140 | * @param displays the intro of a new level two |
el19tb | 60:e1ac7fa5cf17 | 141 | * @param |
el19tb | 60:e1ac7fa5cf17 | 142 | */ |
el19tb | 50:9ffeb4a10c0a | 143 | void newLevel2(); |
el19tb | 60:e1ac7fa5cf17 | 144 | |
el19tb | 60:e1ac7fa5cf17 | 145 | /** |
el19tb | 60:e1ac7fa5cf17 | 146 | * @param first part of the intro |
el19tb | 60:e1ac7fa5cf17 | 147 | */ |
el19tb | 56:2797166656e0 | 148 | void introOne(); |
el19tb | 60:e1ac7fa5cf17 | 149 | |
el19tb | 60:e1ac7fa5cf17 | 150 | /** |
el19tb | 60:e1ac7fa5cf17 | 151 | * @param second part of the intro |
el19tb | 60:e1ac7fa5cf17 | 152 | */ |
el19tb | 56:2797166656e0 | 153 | void introTwo(); |
el19tb | 60:e1ac7fa5cf17 | 154 | |
el19tb | 60:e1ac7fa5cf17 | 155 | /** |
el19tb | 60:e1ac7fa5cf17 | 156 | * @param displays turtle object to screen |
el19tb | 60:e1ac7fa5cf17 | 157 | * @param x - x pos of the turtle |
el19tb | 60:e1ac7fa5cf17 | 158 | * @param y - y pos of the turtle |
el19tb | 60:e1ac7fa5cf17 | 159 | * @param turtle_state - animation state of turtle |
el19tb | 60:e1ac7fa5cf17 | 160 | */ |
el19tb | 52:1145e99264ea | 161 | void displayTurtles(int x, int y, char c, int turtle_state); |
el19tb | 50:9ffeb4a10c0a | 162 | |
el19tb | 60:e1ac7fa5cf17 | 163 | /** |
el19tb | 60:e1ac7fa5cf17 | 164 | * @param draw safe lanes of the game |
el19tb | 60:e1ac7fa5cf17 | 165 | */ |
el19tb | 50:9ffeb4a10c0a | 166 | void drawSafetyLanes(); |
el19tb | 60:e1ac7fa5cf17 | 167 | |
el19tb | 60:e1ac7fa5cf17 | 168 | /** |
el19tb | 60:e1ac7fa5cf17 | 169 | * @param displays log object to screen |
el19tb | 60:e1ac7fa5cf17 | 170 | * @param x - x pos of the log |
el19tb | 60:e1ac7fa5cf17 | 171 | * @param y - y pos of the log |
el19tb | 60:e1ac7fa5cf17 | 172 | * @param c - sprite of the log |
el19tb | 60:e1ac7fa5cf17 | 173 | */ |
el19tb | 42:04e326dcf09b | 174 | void displayLog(int x, int y, char c); |
el19tb | 60:e1ac7fa5cf17 | 175 | |
el19tb | 60:e1ac7fa5cf17 | 176 | /** |
el19tb | 60:e1ac7fa5cf17 | 177 | * @param displays vehicle object to screen |
el19tb | 60:e1ac7fa5cf17 | 178 | * @param x - x pos of the vehicle |
el19tb | 60:e1ac7fa5cf17 | 179 | * @param y - y pos of the vehicle |
el19tb | 60:e1ac7fa5cf17 | 180 | * @param c - sprite of the vehicle |
el19tb | 60:e1ac7fa5cf17 | 181 | */ |
el19tb | 42:04e326dcf09b | 182 | void displayVehicle(int x, int y, char c); |
el19tb | 42:04e326dcf09b | 183 | |
el19tb | 60:e1ac7fa5cf17 | 184 | /** |
el19tb | 60:e1ac7fa5cf17 | 185 | * @param draw tutorial slide part 1 |
el19tb | 60:e1ac7fa5cf17 | 186 | */ |
el19tb | 50:9ffeb4a10c0a | 187 | void drawTutor1(); |
el19tb | 60:e1ac7fa5cf17 | 188 | |
el19tb | 60:e1ac7fa5cf17 | 189 | /** |
el19tb | 60:e1ac7fa5cf17 | 190 | * @param draw tutorial slide part 2 |
el19tb | 60:e1ac7fa5cf17 | 191 | */ |
el19tb | 50:9ffeb4a10c0a | 192 | void drawTutor2(); |
el19tb | 60:e1ac7fa5cf17 | 193 | |
el19tb | 60:e1ac7fa5cf17 | 194 | /** |
el19tb | 60:e1ac7fa5cf17 | 195 | * @param draw tutorial slide part 3 |
el19tb | 60:e1ac7fa5cf17 | 196 | */ |
el19tb | 50:9ffeb4a10c0a | 197 | void drawTutor3(); |
el19tb | 3:648c9d5001be | 198 | }; |
el19tb | 3:648c9d5001be | 199 | |
el19tb | 3:648c9d5001be | 200 | #endif |
el19tb | 52:1145e99264ea | 201 | |
el19tb | 3:648c9d5001be | 202 |