
Final Commit
Dependencies: mbed
Food/Food.h@7:c38800a428a6, 2018-03-21 (annotated)
- Committer:
- JRM1986
- Date:
- Wed Mar 21 13:09:20 2018 +0000
- Revision:
- 7:c38800a428a6
- Parent:
- 6:f3f508cea1c4
- Child:
- 8:a2b431b9b3f7
Initialisation of Food class completed, de-bugged but not tested with testing class;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JRM1986 | 2:ea90cec2489a | 1 | #ifndef FOOD_H |
JRM1986 | 2:ea90cec2489a | 2 | #define FOOD_H |
JRM1986 | 2:ea90cec2489a | 3 | |
JRM1986 | 2:ea90cec2489a | 4 | #include "mbed.h" |
JRM1986 | 3:50f01159c61d | 5 | #include "FXOS8700CQ.h" |
JRM1986 | 3:50f01159c61d | 6 | #include "Gamepad.h" |
JRM1986 | 2:ea90cec2489a | 7 | #include "N5110.h" |
JRM1986 | 2:ea90cec2489a | 8 | |
JRM1986 | 3:50f01159c61d | 9 | |
JRM1986 | 2:ea90cec2489a | 10 | /** Food Class |
JRM1986 | 1:c3fdbc4b1293 | 11 | * @brief Describes the methods and functions for the food |
JRM1986 | 1:c3fdbc4b1293 | 12 | * @author Joshua R. Marshall |
JRM1986 | 1:c3fdbc4b1293 | 13 | * @date Feb, 2018 |
JRM1986 | 2:ea90cec2489a | 14 | */ |
JRM1986 | 2:ea90cec2489a | 15 | |
JRM1986 | 2:ea90cec2489a | 16 | class Food |
JRM1986 | 2:ea90cec2489a | 17 | { |
JRM1986 | 2:ea90cec2489a | 18 | |
JRM1986 | 2:ea90cec2489a | 19 | public: |
JRM1986 | 2:ea90cec2489a | 20 | Food(); // constructor |
JRM1986 | 2:ea90cec2489a | 21 | ~Food(); // destructor |
JRM1986 | 3:50f01159c61d | 22 | |
JRM1986 | 7:c38800a428a6 | 23 | void init(int pos_x, int pos_y); |
JRM1986 | 6:f3f508cea1c4 | 24 | void update(); |
JRM1986 | 6:f3f508cea1c4 | 25 | |
JRM1986 | 6:f3f508cea1c4 | 26 | Vector2D get_position(); // returns the position of the food |
JRM1986 | 6:f3f508cea1c4 | 27 | void set_position(Vector2D p); // sets the food position at random |
JRM1986 | 6:f3f508cea1c4 | 28 | void draw(N5110 &lcd); // draws the food on the lcd |
JRM1986 | 2:ea90cec2489a | 29 | |
JRM1986 | 2:ea90cec2489a | 30 | |
JRM1986 | 2:ea90cec2489a | 31 | private: |
JRM1986 | 2:ea90cec2489a | 32 | |
JRM1986 | 6:f3f508cea1c4 | 33 | Vector2D _position; |
JRM1986 | 3:50f01159c61d | 34 | int _x; |
JRM1986 | 3:50f01159c61d | 35 | int _y; |
JRM1986 | 2:ea90cec2489a | 36 | |
JRM1986 | 2:ea90cec2489a | 37 | }; |
JRM1986 | 2:ea90cec2489a | 38 | #endif |