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.
Map/Map.h@9:3a0194c87afe, 2019-05-12 (annotated)
- Committer:
- el17ttds
- Date:
- Sun May 12 16:21:08 2019 +0000
- Revision:
- 9:3a0194c87afe
- Parent:
- 6:e8c03f264ffc
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17ttds | 9:3a0194c87afe | 1 | /** My Map Class |
el17ttds | 9:3a0194c87afe | 2 | * @brief Stores and draws all map parameters. |
el17ttds | 9:3a0194c87afe | 3 | * @author Thomas Foster |
el17ttds | 9:3a0194c87afe | 4 | * @date May, 2019 |
el17ttds | 9:3a0194c87afe | 5 | */ |
el17ttds | 2:ee9b361ba6df | 6 | #include "mbed.h" |
el17ttds | 2:ee9b361ba6df | 7 | #include "N5110.h" |
el17ttds | 2:ee9b361ba6df | 8 | #include "Gamepad.h" |
el17ttds | 2:ee9b361ba6df | 9 | |
el17ttds | 9:3a0194c87afe | 10 | class Map { |
el17ttds | 3:3d35ab70b565 | 11 | |
el17ttds | 2:ee9b361ba6df | 12 | public: |
el17ttds | 9:3a0194c87afe | 13 | |
el17ttds | 9:3a0194c87afe | 14 | /** Constructor */ |
el17ttds | 4:3446009e2f38 | 15 | Map(); |
el17ttds | 9:3a0194c87afe | 16 | |
el17ttds | 9:3a0194c87afe | 17 | /** Initialises Maps's variables |
el17ttds | 9:3a0194c87afe | 18 | * @param width (int) |
el17ttds | 9:3a0194c87afe | 19 | * @param width (int) |
el17ttds | 9:3a0194c87afe | 20 | * @param screen width (int) |
el17ttds | 9:3a0194c87afe | 21 | * @param screen height (int) |
el17ttds | 9:3a0194c87afe | 22 | */ |
el17ttds | 4:3446009e2f38 | 23 | void init(int width, int height, int swidth, int sheight); |
el17ttds | 9:3a0194c87afe | 24 | |
el17ttds | 9:3a0194c87afe | 25 | /** Re writes Maps parameters |
el17ttds | 9:3a0194c87afe | 26 | * @param x position (int) |
el17ttds | 9:3a0194c87afe | 27 | * @param y position (int) |
el17ttds | 9:3a0194c87afe | 28 | */ |
el17ttds | 4:3446009e2f38 | 29 | void write(int x1, int y1); |
el17ttds | 9:3a0194c87afe | 30 | |
el17ttds | 9:3a0194c87afe | 31 | /** Draws four rectangles on screen |
el17ttds | 9:3a0194c87afe | 32 | * @param The N5110 library (N5110) |
el17ttds | 9:3a0194c87afe | 33 | */ |
el17ttds | 4:3446009e2f38 | 34 | void draw(N5110 &lcd); |
el17ttds | 2:ee9b361ba6df | 35 | private: |
el17ttds | 4:3446009e2f38 | 36 | void map_parameters(); |
el17ttds | 4:3446009e2f38 | 37 | void horizontal(); |
el17ttds | 4:3446009e2f38 | 38 | void veritical(); |
el17ttds | 4:3446009e2f38 | 39 | int _w; // changing dimensions of top and left sides of map |
el17ttds | 4:3446009e2f38 | 40 | int _h; |
el17ttds | 4:3446009e2f38 | 41 | int _x1; // origin locations of map corners |
el17ttds | 4:3446009e2f38 | 42 | int _y1; |
el17ttds | 4:3446009e2f38 | 43 | int _x2; |
el17ttds | 4:3446009e2f38 | 44 | int _y2; |
el17ttds | 4:3446009e2f38 | 45 | int _swidth; // dimensions of screen |
el17ttds | 4:3446009e2f38 | 46 | int _sheight; |
el17ttds | 4:3446009e2f38 | 47 | int _width; // dimensions of avaliable space in game |
el17ttds | 4:3446009e2f38 | 48 | int _height; |
el17ttds | 4:3446009e2f38 | 49 | int _x1_pos; |
el17ttds | 4:3446009e2f38 | 50 | int _y1_pos; |
el17ttds | 4:3446009e2f38 | 51 | }; |