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.
Dependencies: mbed
RosenEngine/RosenEngine.h@42:ee13e1d103d8, 2019-05-08 (annotated)
- Committer:
- ikenna1
- Date:
- Wed May 08 11:18:40 2019 +0000
- Revision:
- 42:ee13e1d103d8
- Parent:
- 41:e1fa36c0492e
Change the way Lcd and Gamepad libraries are accessed for ease of documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ikenna1 | 2:66a4e5d7a7cd | 1 | #ifndef ROSENENGINE_H |
ikenna1 | 2:66a4e5d7a7cd | 2 | #define ROSENENGINE_H |
ikenna1 | 2:66a4e5d7a7cd | 3 | |
ikenna1 | 2:66a4e5d7a7cd | 4 | #include "mbed.h" |
ikenna1 | 37:8d8c8cce0bc7 | 5 | #include <ctime> |
ikenna1 | 2:66a4e5d7a7cd | 6 | #include "N5110.h" |
ikenna1 | 2:66a4e5d7a7cd | 7 | #include "Gamepad.h" |
ikenna1 | 7:ed5870cfb3e0 | 8 | #include "Ship.h" |
ikenna1 | 9:241a1a7d8527 | 9 | #include "Weapons.h" |
ikenna1 | 9:241a1a7d8527 | 10 | #include "Menu.h" |
ikenna1 | 15:009ccc07bb57 | 11 | #include "Enemy.h" |
ikenna1 | 17:e65a9f981834 | 12 | #include "Health.h" |
ikenna1 | 39:7824f9080f59 | 13 | #include "Lore.h" |
ikenna1 | 2:66a4e5d7a7cd | 14 | |
ikenna1 | 2:66a4e5d7a7cd | 15 | class RosenEngine |
ikenna1 | 2:66a4e5d7a7cd | 16 | { |
ikenna1 | 2:66a4e5d7a7cd | 17 | |
ikenna1 | 2:66a4e5d7a7cd | 18 | public: |
ikenna1 | 2:66a4e5d7a7cd | 19 | RosenEngine(); |
ikenna1 | 2:66a4e5d7a7cd | 20 | ~RosenEngine(); |
ikenna1 | 3:f9cd1a38d5c6 | 21 | |
ikenna1 | 42:ee13e1d103d8 | 22 | void init(int ship_width,int ship_height,int ship_speed,int ship_xpos,int ship_ypos,N5110 *lcd, Gamepad *pad); |
ikenna1 | 27:f99249e727fd | 23 | void reset(); |
ikenna1 | 42:ee13e1d103d8 | 24 | void read_input(); |
ikenna1 | 42:ee13e1d103d8 | 25 | void update(); |
ikenna1 | 42:ee13e1d103d8 | 26 | void draw(); |
ikenna1 | 9:241a1a7d8527 | 27 | void get_pos(); |
ikenna1 | 42:ee13e1d103d8 | 28 | void title(); |
ikenna1 | 13:e114d362186d | 29 | int get_ycursor(); |
ikenna1 | 21:628fb703188f | 30 | int get_shipno(); |
ikenna1 | 42:ee13e1d103d8 | 31 | void ship_select(); |
ikenna1 | 36:c25417f0d150 | 32 | void check_health(); |
ikenna1 | 38:4571537238ed | 33 | float timer(int fps); |
ikenna1 | 38:4571537238ed | 34 | bool dead(); |
ikenna1 | 42:ee13e1d103d8 | 35 | void intro(); |
ikenna1 | 40:90c7a893d513 | 36 | Vector2D get_enemynum(); |
ikenna1 | 30:711d722f3cef | 37 | |
ikenna1 | 25:faba9eb44514 | 38 | //*** note: add ship width and ship heirgth in place of 6 and 9 to generalize arrays after they are finished |
ikenna1 | 10:c33d7593a275 | 39 | |
ikenna1 | 2:66a4e5d7a7cd | 40 | private: |
ikenna1 | 42:ee13e1d103d8 | 41 | void update_shooter_weapon(); |
ikenna1 | 42:ee13e1d103d8 | 42 | void draw_ship(); |
ikenna1 | 41:e1fa36c0492e | 43 | void set_ship_size(); |
ikenna1 | 30:711d722f3cef | 44 | void score(int points); |
ikenna1 | 35:3341f2bd0408 | 45 | bool check_collision(int xpos1, int ypos1,int width1,int height1,int xpos2, int ypos2,int width2,int height2); |
ikenna1 | 35:3341f2bd0408 | 46 | bool check_collision1(int xpos1,int width1,int xpos2,int width2); |
ikenna1 | 35:3341f2bd0408 | 47 | void test(); |
ikenna1 | 42:ee13e1d103d8 | 48 | void seeker_ship_collision(); |
ikenna1 | 42:ee13e1d103d8 | 49 | void shooter_ship_collision(); |
ikenna1 | 42:ee13e1d103d8 | 50 | void shooterw_ship_collision(); |
ikenna1 | 42:ee13e1d103d8 | 51 | void kestrelw_seeker_collision(); |
ikenna1 | 42:ee13e1d103d8 | 52 | void imperionw_seeker_collision(); |
ikenna1 | 42:ee13e1d103d8 | 53 | void kestrelw_shooter_collision(); |
ikenna1 | 42:ee13e1d103d8 | 54 | void imperionw_shooter_collision(); |
ikenna1 | 42:ee13e1d103d8 | 55 | void orionw_collision(); |
ikenna1 | 38:4571537238ed | 56 | void scaling(float time_elapsed); |
ikenna1 | 37:8d8c8cce0bc7 | 57 | int rand_no(); |
ikenna1 | 42:ee13e1d103d8 | 58 | void game_over(); |
ikenna1 | 42:ee13e1d103d8 | 59 | void disp_points(); |
ikenna1 | 39:7824f9080f59 | 60 | void check_se_health(); |
ikenna1 | 39:7824f9080f59 | 61 | void check_sh_health(); |
ikenna1 | 40:90c7a893d513 | 62 | int range(int x1, int y1, float x2, float y2); |
ikenna1 | 40:90c7a893d513 | 63 | Vector2D find_closest1(); |
ikenna1 | 40:90c7a893d513 | 64 | Vector2D find_closest2(int index); |
ikenna1 | 4:740e14ebbc97 | 65 | |
ikenna1 | 36:c25417f0d150 | 66 | |
ikenna1 | 4:740e14ebbc97 | 67 | // Variables |
ikenna1 | 8:87a845b8575e | 68 | Ship _ship; |
ikenna1 | 9:241a1a7d8527 | 69 | Weapons _weapons; |
ikenna1 | 9:241a1a7d8527 | 70 | Menu _menu; |
ikenna1 | 15:009ccc07bb57 | 71 | Enemy _enemy; |
ikenna1 | 17:e65a9f981834 | 72 | Health _health; |
ikenna1 | 39:7824f9080f59 | 73 | Lore _lore; |
ikenna1 | 41:e1fa36c0492e | 74 | Vector2D _joystick; |
ikenna1 | 9:241a1a7d8527 | 75 | Direction _d; |
ikenna1 | 10:c33d7593a275 | 76 | int _ycursor; |
ikenna1 | 21:628fb703188f | 77 | int _shipno; |
ikenna1 | 30:711d722f3cef | 78 | int _score; |
ikenna1 | 34:6d0786582d81 | 79 | int _shno; |
ikenna1 | 41:e1fa36c0492e | 80 | int _shipWidth; |
ikenna1 | 41:e1fa36c0492e | 81 | int _shipHeight; |
ikenna1 | 41:e1fa36c0492e | 82 | Vector2D _shipPos; |
ikenna1 | 41:e1fa36c0492e | 83 | Vector2D _shooterPos[3]; |
ikenna1 | 41:e1fa36c0492e | 84 | Vector2D _shooterWPos[3]; |
ikenna1 | 41:e1fa36c0492e | 85 | Vector2D _seekerPos[3]; |
ikenna1 | 34:6d0786582d81 | 86 | Vector2D _coloc; |
ikenna1 | 36:c25417f0d150 | 87 | bool _dead; |
ikenna1 | 38:4571537238ed | 88 | int _times_run; |
ikenna1 | 38:4571537238ed | 89 | int _no_shooters; |
ikenna1 | 39:7824f9080f59 | 90 | int _no_seekers; |
ikenna1 | 39:7824f9080f59 | 91 | bool _intro; |
ikenna1 | 39:7824f9080f59 | 92 | float _wait_time; |
ikenna1 | 42:ee13e1d103d8 | 93 | Gamepad *_pad; |
ikenna1 | 42:ee13e1d103d8 | 94 | N5110 *_lcd; |
ikenna1 | 25:faba9eb44514 | 95 | |
ikenna1 | 2:66a4e5d7a7cd | 96 | |
ikenna1 | 2:66a4e5d7a7cd | 97 | }; |
ikenna1 | 42:ee13e1d103d8 | 98 | |
ikenna1 | 35:3341f2bd0408 | 99 | #endif |
ikenna1 | 42:ee13e1d103d8 | 100 |