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.
Laser/Laser.h@129:b47c28c7eaaf, 2019-05-08 (annotated)
- Committer:
- jamesheavey
- Date:
- Wed May 08 23:09:59 2019 +0000
- Revision:
- 129:b47c28c7eaaf
- Parent:
- 93:18f81996ea89
- Child:
- 130:46f3fac2bdf9
doxygen done, add some printfs and maybe do menu class
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jamesheavey | 28:d058f7f5885d | 1 | #ifndef LASER_H |
| jamesheavey | 28:d058f7f5885d | 2 | #define LASER_H |
| jamesheavey | 28:d058f7f5885d | 3 | |
| jamesheavey | 28:d058f7f5885d | 4 | #include "mbed.h" |
| jamesheavey | 28:d058f7f5885d | 5 | #include "N5110.h" |
| jamesheavey | 28:d058f7f5885d | 6 | #include "Gamepad.h" |
| jamesheavey | 28:d058f7f5885d | 7 | #include "Paddle.h" |
| jamesheavey | 28:d058f7f5885d | 8 | |
| jamesheavey | 129:b47c28c7eaaf | 9 | /** Laser Class |
| jamesheavey | 86:01f33d94e496 | 10 | @author James Heavey, University of Leeds |
| jamesheavey | 91:c01a736fb0d9 | 11 | @brief Controls the Laser in the Breakout game |
| jamesheavey | 86:01f33d94e496 | 12 | @date May 2019 |
| jamesheavey | 91:c01a736fb0d9 | 13 | */ |
| jamesheavey | 28:d058f7f5885d | 14 | class Laser |
| jamesheavey | 28:d058f7f5885d | 15 | { |
| jamesheavey | 28:d058f7f5885d | 16 | |
| jamesheavey | 28:d058f7f5885d | 17 | public: |
| jamesheavey | 129:b47c28c7eaaf | 18 | |
| jamesheavey | 129:b47c28c7eaaf | 19 | /** Constructor declaration */ |
| jamesheavey | 28:d058f7f5885d | 20 | Laser(); |
| jamesheavey | 129:b47c28c7eaaf | 21 | |
| jamesheavey | 129:b47c28c7eaaf | 22 | /** Deconstructor declaration */ |
| jamesheavey | 28:d058f7f5885d | 23 | ~Laser(); |
| jamesheavey | 129:b47c28c7eaaf | 24 | |
| jamesheavey | 129:b47c28c7eaaf | 25 | /** Initialises the laser off screen with a set velocity */ |
| jamesheavey | 93:18f81996ea89 | 26 | void init(); |
| jamesheavey | 129:b47c28c7eaaf | 27 | |
| jamesheavey | 129:b47c28c7eaaf | 28 | /** Draws the Laser at at its current coordinates on the LCD |
| jamesheavey | 129:b47c28c7eaaf | 29 | * @param &lcd @details a N5110 pointer |
| jamesheavey | 129:b47c28c7eaaf | 30 | */ |
| jamesheavey | 28:d058f7f5885d | 31 | void draw(N5110 &lcd); |
| jamesheavey | 129:b47c28c7eaaf | 32 | |
| jamesheavey | 129:b47c28c7eaaf | 33 | /** Update the Laser's y coordinate based on its velocity */ |
| jamesheavey | 28:d058f7f5885d | 34 | void update(); |
| jamesheavey | 129:b47c28c7eaaf | 35 | |
| jamesheavey | 129:b47c28c7eaaf | 36 | /** Sets the Laser's x coordinate |
| jamesheavey | 129:b47c28c7eaaf | 37 | * @param x @details set the member variable _x to the new local x |
| jamesheavey | 129:b47c28c7eaaf | 38 | */ |
| jamesheavey | 129:b47c28c7eaaf | 39 | void set_posx(int x); |
| jamesheavey | 129:b47c28c7eaaf | 40 | |
| jamesheavey | 129:b47c28c7eaaf | 41 | /** Sets the Laser's x coordinate |
| jamesheavey | 129:b47c28c7eaaf | 42 | * @param y @details set the member variable _y to the new local y |
| jamesheavey | 129:b47c28c7eaaf | 43 | */ |
| jamesheavey | 129:b47c28c7eaaf | 44 | void set_posy(int y); |
| jamesheavey | 129:b47c28c7eaaf | 45 | |
| jamesheavey | 129:b47c28c7eaaf | 46 | /** Retrieve the Laser's current x coordinate |
| jamesheavey | 129:b47c28c7eaaf | 47 | * @return returns member variable _x as an integer |
| jamesheavey | 129:b47c28c7eaaf | 48 | */ |
| jamesheavey | 36:cb73014d3a99 | 49 | int get_x(); |
| jamesheavey | 129:b47c28c7eaaf | 50 | |
| jamesheavey | 129:b47c28c7eaaf | 51 | /** Retrieve the Laser's current y coordinate |
| jamesheavey | 129:b47c28c7eaaf | 52 | * @return returns member variable _y as an integer |
| jamesheavey | 129:b47c28c7eaaf | 53 | */ |
| jamesheavey | 36:cb73014d3a99 | 54 | int get_y(); |
| jamesheavey | 91:c01a736fb0d9 | 55 | |
| jamesheavey | 28:d058f7f5885d | 56 | private: |
| jamesheavey | 28:d058f7f5885d | 57 | |
| jamesheavey | 93:18f81996ea89 | 58 | int _speed_y; |
| jamesheavey | 28:d058f7f5885d | 59 | int _x; |
| jamesheavey | 28:d058f7f5885d | 60 | int _y; |
| jamesheavey | 129:b47c28c7eaaf | 61 | |
| jamesheavey | 28:d058f7f5885d | 62 | }; |
| jamesheavey | 28:d058f7f5885d | 63 | #endif |