
Final Commit
Dependencies: mbed
Food/Food.h@15:4c97fe30f3b7, 2018-04-12 (annotated)
- Committer:
- JRM1986
- Date:
- Thu Apr 12 12:41:05 2018 +0000
- Revision:
- 15:4c97fe30f3b7
- Parent:
- 8:a2b431b9b3f7
- Child:
- 17:94dd8a691d4a
Food randomly appears, at user defined intervals;
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 | 15:4c97fe30f3b7 | 9 | int g_frame_counter(); |
JRM1986 | 15:4c97fe30f3b7 | 10 | |
JRM1986 | 15:4c97fe30f3b7 | 11 | static int g_fc; |
JRM1986 | 3:50f01159c61d | 12 | |
JRM1986 | 2:ea90cec2489a | 13 | /** Food Class |
JRM1986 | 1:c3fdbc4b1293 | 14 | * @brief Describes the methods and functions for the food |
JRM1986 | 1:c3fdbc4b1293 | 15 | * @author Joshua R. Marshall |
JRM1986 | 1:c3fdbc4b1293 | 16 | * @date Feb, 2018 |
JRM1986 | 2:ea90cec2489a | 17 | */ |
JRM1986 | 2:ea90cec2489a | 18 | |
JRM1986 | 2:ea90cec2489a | 19 | class Food |
JRM1986 | 2:ea90cec2489a | 20 | { |
JRM1986 | 2:ea90cec2489a | 21 | |
JRM1986 | 2:ea90cec2489a | 22 | public: |
JRM1986 | 2:ea90cec2489a | 23 | Food(); // constructor |
JRM1986 | 2:ea90cec2489a | 24 | ~Food(); // destructor |
JRM1986 | 3:50f01159c61d | 25 | |
JRM1986 | 7:c38800a428a6 | 26 | void init(int pos_x, int pos_y); |
JRM1986 | 6:f3f508cea1c4 | 27 | void update(); |
JRM1986 | 6:f3f508cea1c4 | 28 | void draw(N5110 &lcd); // draws the food on the lcd |
JRM1986 | 2:ea90cec2489a | 29 | |
JRM1986 | 15:4c97fe30f3b7 | 30 | Vector2D get_rand_pos(); // gets a random number between 0-48, and 0-84 |
JRM1986 | 15:4c97fe30f3b7 | 31 | |
JRM1986 | 15:4c97fe30f3b7 | 32 | void set_food_position(int set_frames, int number_frames); |
JRM1986 | 15:4c97fe30f3b7 | 33 | Vector2D get_food_position(); |
JRM1986 | 2:ea90cec2489a | 34 | |
JRM1986 | 2:ea90cec2489a | 35 | private: |
JRM1986 | 2:ea90cec2489a | 36 | |
JRM1986 | 3:50f01159c61d | 37 | int _x; |
JRM1986 | 3:50f01159c61d | 38 | int _y; |
JRM1986 | 2:ea90cec2489a | 39 | |
JRM1986 | 2:ea90cec2489a | 40 | }; |
JRM1986 | 2:ea90cec2489a | 41 | #endif |