Target Library
Dependents: GameProject_Prototype
Target.h@14:0f590475ba85, 2017-05-04 (annotated)
- Committer:
- ll14c4p
- Date:
- Thu May 04 11:36:45 2017 +0000
- Revision:
- 14:0f590475ba85
- Parent:
- 13:828ede9cf8a5
+Deoxygen
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ll14c4p | 10:45a0af3e607c | 1 | #ifndef TARGET_H |
ll14c4p | 10:45a0af3e607c | 2 | #define TARGET_H |
ll14c4p | 10:45a0af3e607c | 3 | |
ll14c4p | 10:45a0af3e607c | 4 | #include "mbed.h" |
ll14c4p | 10:45a0af3e607c | 5 | #include "N5110.h" |
ll14c4p | 10:45a0af3e607c | 6 | #include "Gamepad.h" |
ll14c4p | 10:45a0af3e607c | 7 | |
ll14c4p | 10:45a0af3e607c | 8 | |
ll14c4p | 10:45a0af3e607c | 9 | class Target |
ll14c4p | 10:45a0af3e607c | 10 | { |
ll14c4p | 10:45a0af3e607c | 11 | public: |
ll14c4p | 10:45a0af3e607c | 12 | Target(); |
ll14c4p | 10:45a0af3e607c | 13 | ~Target(); |
ll14c4p | 14:0f590475ba85 | 14 | |
ll14c4p | 14:0f590475ba85 | 15 | /** Initialise Target |
ll14c4p | 14:0f590475ba85 | 16 | * |
ll14c4p | 14:0f590475ba85 | 17 | * This function initialises the target library. |
ll14c4p | 14:0f590475ba85 | 18 | */ |
ll14c4p | 10:45a0af3e607c | 19 | void init(); |
ll14c4p | 14:0f590475ba85 | 20 | |
ll14c4p | 14:0f590475ba85 | 21 | /** Draw |
ll14c4p | 14:0f590475ba85 | 22 | * |
ll14c4p | 14:0f590475ba85 | 23 | * This function draws the target sprite onto the screen. |
ll14c4p | 14:0f590475ba85 | 24 | */ |
ll14c4p | 10:45a0af3e607c | 25 | void draw(N5110 &lcd); |
ll14c4p | 14:0f590475ba85 | 26 | |
ll14c4p | 14:0f590475ba85 | 27 | /** Update |
ll14c4p | 14:0f590475ba85 | 28 | * |
ll14c4p | 14:0f590475ba85 | 29 | * This function updates the position of the target as it moves on the screen. |
ll14c4p | 14:0f590475ba85 | 30 | */ |
ll14c4p | 10:45a0af3e607c | 31 | void update(); |
ll14c4p | 14:0f590475ba85 | 32 | |
ll14c4p | 14:0f590475ba85 | 33 | /** Get Position |
ll14c4p | 14:0f590475ba85 | 34 | * |
ll14c4p | 14:0f590475ba85 | 35 | * This function obtains the coordinates of the top-left pixel in the targets sprite. |
ll14c4p | 14:0f590475ba85 | 36 | */ |
ll14c4p | 10:45a0af3e607c | 37 | Vector2D get_pos(); |
ll14c4p | 14:0f590475ba85 | 38 | |
ll14c4p | 14:0f590475ba85 | 39 | /** Set Position |
ll14c4p | 14:0f590475ba85 | 40 | * |
ll14c4p | 14:0f590475ba85 | 41 | * This function is used to change the position of the sprite to specific coordinates when called. |
ll14c4p | 14:0f590475ba85 | 42 | */ |
ll14c4p | 11:5b2be6934e1b | 43 | void set_pos(Vector2D p); |
ll14c4p | 10:45a0af3e607c | 44 | |
ll14c4p | 10:45a0af3e607c | 45 | private: |
ll14c4p | 10:45a0af3e607c | 46 | int n; |
ll14c4p | 10:45a0af3e607c | 47 | int _x; |
ll14c4p | 10:45a0af3e607c | 48 | int _y; |
ll14c4p | 10:45a0af3e607c | 49 | Vector2D _velocity; |
ll14c4p | 10:45a0af3e607c | 50 | |
ll14c4p | 10:45a0af3e607c | 51 | }; |
ll14c4p | 10:45a0af3e607c | 52 | #endif |