Stick_Runner
Dependencies: FXOS8700CQ Gamepad N5110 SDFileSystem mbed
Gems/Gems.h@3:0c690f1c04d8, 2017-05-03 (annotated)
- Committer:
- el15ss
- Date:
- Wed May 03 09:27:04 2017 +0000
- Revision:
- 3:0c690f1c04d8
- Parent:
- 2:98a41609c827
- Child:
- 4:2fdafb53eac2
Added DOxygen commenting to all files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el15ss | 0:12cfe63faa6a | 1 | #ifndef Gems_H |
el15ss | 0:12cfe63faa6a | 2 | #define Gems_H |
el15ss | 0:12cfe63faa6a | 3 | |
el15ss | 0:12cfe63faa6a | 4 | #include "mbed.h" |
el15ss | 0:12cfe63faa6a | 5 | #include "N5110.h" |
el15ss | 0:12cfe63faa6a | 6 | #include "Gamepad.h" |
el15ss | 0:12cfe63faa6a | 7 | |
el15ss | 3:0c690f1c04d8 | 8 | |
el15ss | 3:0c690f1c04d8 | 9 | /** Class Character |
el15ss | 3:0c690f1c04d8 | 10 | @brief Class responsible for all the functionality of the gem including intialization, drawing, moving, checking whether the character consumes it |
el15ss | 3:0c690f1c04d8 | 11 | @brief and updating it |
el15ss | 3:0c690f1c04d8 | 12 | @author Samrudh Sharma |
el15ss | 3:0c690f1c04d8 | 13 | @date |
el15ss | 3:0c690f1c04d8 | 14 | */ |
el15ss | 0:12cfe63faa6a | 15 | class Gems |
el15ss | 0:12cfe63faa6a | 16 | { |
el15ss | 0:12cfe63faa6a | 17 | public: |
el15ss | 0:12cfe63faa6a | 18 | |
el15ss | 3:0c690f1c04d8 | 19 | /** Initialise display |
el15ss | 3:0c690f1c04d8 | 20 | * |
el15ss | 3:0c690f1c04d8 | 21 | * Powers up the display and turns on backlight (50% brightness default). |
el15ss | 3:0c690f1c04d8 | 22 | * Intialises the charchter status, x and y co-ordinate of the gem. |
el15ss | 3:0c690f1c04d8 | 23 | */ |
el15ss | 0:12cfe63faa6a | 24 | void init(); |
el15ss | 3:0c690f1c04d8 | 25 | |
el15ss | 3:0c690f1c04d8 | 26 | /** Function to draw the gem |
el15ss | 3:0c690f1c04d8 | 27 | * |
el15ss | 3:0c690f1c04d8 | 28 | * Draws the obstacle to the display using the N5110 library and its object lcd. |
el15ss | 3:0c690f1c04d8 | 29 | * |
el15ss | 3:0c690f1c04d8 | 30 | */ |
el15ss | 0:12cfe63faa6a | 31 | void draw(N5110 &lcd); |
el15ss | 3:0c690f1c04d8 | 32 | |
el15ss | 3:0c690f1c04d8 | 33 | /** Updates/Moves Obstacle |
el15ss | 3:0c690f1c04d8 | 34 | * |
el15ss | 3:0c690f1c04d8 | 35 | * Helps the Gem move by updating its position on the screen by 2 pixel each time |
el15ss | 3:0c690f1c04d8 | 36 | * therefore setting its speed aswell. |
el15ss | 3:0c690f1c04d8 | 37 | */ |
el15ss | 1:db9ff66f67c8 | 38 | void updateGems(); |
el15ss | 3:0c690f1c04d8 | 39 | |
el15ss | 3:0c690f1c04d8 | 40 | /** Gem Status |
el15ss | 3:0c690f1c04d8 | 41 | * |
el15ss | 3:0c690f1c04d8 | 42 | * This fuction helps to check whether the character has touched a gem and updating it status to make diappear from the screen |
el15ss | 3:0c690f1c04d8 | 43 | * and also to check if it has reached the bottom of the screen and updates the obstacle status |
el15ss | 3:0c690f1c04d8 | 44 | * to false so that the gems can be generated again this creating a continuous flow of gems |
el15ss | 3:0c690f1c04d8 | 45 | * |
el15ss | 3:0c690f1c04d8 | 46 | * @param p - stores the 2D location i.e. the (x,y) co-ordinate of the cetre point of the gem on the screen . |
el15ss | 3:0c690f1c04d8 | 47 | */ |
el15ss | 1:db9ff66f67c8 | 48 | void gemStatus(Vector2D p); |
el15ss | 2:98a41609c827 | 49 | |
el15ss | 3:0c690f1c04d8 | 50 | /** Gem Position |
el15ss | 3:0c690f1c04d8 | 51 | * |
el15ss | 3:0c690f1c04d8 | 52 | * Returns the 2D location i.e. the (x,y) co-ordinate of the cetre point of the gem on the screen . |
el15ss | 3:0c690f1c04d8 | 53 | */ |
el15ss | 1:db9ff66f67c8 | 54 | Vector2D getGemPos(); |
el15ss | 2:98a41609c827 | 55 | |
el15ss | 3:0c690f1c04d8 | 56 | /** Return Gem Status |
el15ss | 3:0c690f1c04d8 | 57 | * |
el15ss | 3:0c690f1c04d8 | 58 | * Returns the status of the gem which is sent to the main, where it is used to determine whether the gems have to be intialized or |
el15ss | 3:0c690f1c04d8 | 59 | * or renderd again. |
el15ss | 3:0c690f1c04d8 | 60 | */ |
el15ss | 3:0c690f1c04d8 | 61 | |
el15ss | 1:db9ff66f67c8 | 62 | bool getGemStatus(); |
el15ss | 2:98a41609c827 | 63 | |
el15ss | 0:12cfe63faa6a | 64 | |
el15ss | 0:12cfe63faa6a | 65 | private: |
el15ss | 3:0c690f1c04d8 | 66 | |
el15ss | 3:0c690f1c04d8 | 67 | //Variables |
el15ss | 3:0c690f1c04d8 | 68 | int gemPosX; // X cocordinate of the gem |
el15ss | 3:0c690f1c04d8 | 69 | int gemPosY; // Y cocordinate of the gem |
el15ss | 3:0c690f1c04d8 | 70 | bool gStatus; //Variable to store the Obstacles status |
el15ss | 1:db9ff66f67c8 | 71 | |
el15ss | 0:12cfe63faa6a | 72 | }; |
el15ss | 0:12cfe63faa6a | 73 | #endif |