ECE2035 Project 2
Dependencies: mbed mbed-rtos SDFileSystem
graphics.h@10:1994adcfc86f, 2021-04-20 (annotated)
- Committer:
- kwengryn3
- Date:
- Tue Apr 20 18:15:22 2021 +0000
- Revision:
- 10:1994adcfc86f
- Parent:
- 0:bff8b9020128
adv features
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kwengryn3 | 0:bff8b9020128 | 1 | #ifndef GRAPHICS_H |
kwengryn3 | 0:bff8b9020128 | 2 | #define GRAPHICS_H |
kwengryn3 | 0:bff8b9020128 | 3 | #include "globals.h" |
kwengryn3 | 0:bff8b9020128 | 4 | |
kwengryn3 | 0:bff8b9020128 | 5 | // TODO: Determine X and Y Ranges |
kwengryn3 | 0:bff8b9020128 | 6 | #define SIZE_X 127 |
kwengryn3 | 0:bff8b9020128 | 7 | #define SIZE_Y 127 |
kwengryn3 | 0:bff8b9020128 | 8 | |
kwengryn3 | 0:bff8b9020128 | 9 | // The bottom of the screen => y=127 |
kwengryn3 | 0:bff8b9020128 | 10 | // lets the compost piles grow up from the bottom of the screen. It is awkward. |
kwengryn3 | 0:bff8b9020128 | 11 | // Thus, we use a macro to reverse the coordinate for convenience. |
kwengryn3 | 0:bff8b9020128 | 12 | #define REVERSE_Y(x) (SIZE_Y-(x)) |
kwengryn3 | 0:bff8b9020128 | 13 | |
kwengryn3 | 0:bff8b9020128 | 14 | /** |
kwengryn3 | 0:bff8b9020128 | 15 | * Draws the player. This depends on the player state, so it is not a DrawFunc. |
kwengryn3 | 0:bff8b9020128 | 16 | */ |
kwengryn3 | 0:bff8b9020128 | 17 | void draw_player(int u, int v, int key); |
kwengryn3 | 0:bff8b9020128 | 18 | |
kwengryn3 | 0:bff8b9020128 | 19 | /** |
kwengryn3 | 0:bff8b9020128 | 20 | * Takes a string image and draws it to the screen. The string is 121 characters |
kwengryn3 | 0:bff8b9020128 | 21 | * long, and represents an 11x11 tile in row-major ordering (across, then down, |
kwengryn3 | 0:bff8b9020128 | 22 | * like a regular multi-dimensional array). The available colors are: |
kwengryn3 | 0:bff8b9020128 | 23 | * R = Red |
kwengryn3 | 0:bff8b9020128 | 24 | * Y = Yellow |
kwengryn3 | 0:bff8b9020128 | 25 | * G = Green |
kwengryn3 | 0:bff8b9020128 | 26 | * D = Brown ("dirt") |
kwengryn3 | 0:bff8b9020128 | 27 | * 5 = Light grey (50%) |
kwengryn3 | 0:bff8b9020128 | 28 | * 3 = Dark grey (30%) |
kwengryn3 | 0:bff8b9020128 | 29 | * Any other character is black |
kwengryn3 | 0:bff8b9020128 | 30 | * More colors can be easily added by following the pattern already given. |
kwengryn3 | 0:bff8b9020128 | 31 | */ |
kwengryn3 | 0:bff8b9020128 | 32 | void draw_img(int u, int v, const char* img); |
kwengryn3 | 0:bff8b9020128 | 33 | |
kwengryn3 | 0:bff8b9020128 | 34 | /** |
kwengryn3 | 0:bff8b9020128 | 35 | * DrawFunc functions. |
kwengryn3 | 0:bff8b9020128 | 36 | * These can be used as the MapItem draw functions. |
kwengryn3 | 0:bff8b9020128 | 37 | */ |
kwengryn3 | 0:bff8b9020128 | 38 | void draw_nothing(boundingBox b); |
kwengryn3 | 0:bff8b9020128 | 39 | void draw_bomb(boundingBox b); |
kwengryn3 | 0:bff8b9020128 | 40 | void draw_banana(boundingBox b); |
kwengryn3 | 0:bff8b9020128 | 41 | void draw_orange(boundingBox b); |
kwengryn3 | 10:1994adcfc86f | 42 | void draw_apple(boundingBox b); |
kwengryn3 | 0:bff8b9020128 | 43 | |
kwengryn3 | 0:bff8b9020128 | 44 | |
kwengryn3 | 0:bff8b9020128 | 45 | #endif // GRAPHICS_H |