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
SpaceInvaderEngine/SpaceInvaderEngine.h@6:5bea67cc96f9, 2020-03-23 (annotated)
- Committer:
- josh_ohara
- Date:
- Mon Mar 23 15:20:59 2020 +0000
- Revision:
- 6:5bea67cc96f9
- Child:
- 7:06a2558155f0
Beginning engine contruction
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
josh_ohara | 6:5bea67cc96f9 | 1 | #ifndef SPACEINVADERENGINE_H |
josh_ohara | 6:5bea67cc96f9 | 2 | #define SPACEINVADERENGINE_H |
josh_ohara | 6:5bea67cc96f9 | 3 | |
josh_ohara | 6:5bea67cc96f9 | 4 | #include "mbed.h" |
josh_ohara | 6:5bea67cc96f9 | 5 | #include "N5110.h" |
josh_ohara | 6:5bea67cc96f9 | 6 | #include "Gamepad.h" |
josh_ohara | 6:5bea67cc96f9 | 7 | #include "BulletS.h" |
josh_ohara | 6:5bea67cc96f9 | 8 | #include "Ship.h" |
josh_ohara | 6:5bea67cc96f9 | 9 | #include "Alien.h" |
josh_ohara | 6:5bea67cc96f9 | 10 | |
josh_ohara | 6:5bea67cc96f9 | 11 | #define BORDER 2 |
josh_ohara | 6:5bea67cc96f9 | 12 | |
josh_ohara | 6:5bea67cc96f9 | 13 | class SpaceInvaderEngine |
josh_ohara | 6:5bea67cc96f9 | 14 | { |
josh_ohara | 6:5bea67cc96f9 | 15 | |
josh_ohara | 6:5bea67cc96f9 | 16 | public: |
josh_ohara | 6:5bea67cc96f9 | 17 | SpaceInvaderEngine(); |
josh_ohara | 6:5bea67cc96f9 | 18 | void init(int ship_height, int ship_width, int ship_bullet_size, int speed, int alien_size); |
josh_ohara | 6:5bea67cc96f9 | 19 | void read_input(Gamepad &pad); |
josh_ohara | 6:5bea67cc96f9 | 20 | void update(Gamepad &pad); |
josh_ohara | 6:5bea67cc96f9 | 21 | void draw(N5110 &lcd); |
josh_ohara | 6:5bea67cc96f9 | 22 | |
josh_ohara | 6:5bea67cc96f9 | 23 | private: |
josh_ohara | 6:5bea67cc96f9 | 24 | |
josh_ohara | 6:5bea67cc96f9 | 25 | void read_input(Gamepad &pad); |
josh_ohara | 6:5bea67cc96f9 | 26 | void draw(N5110 &lcd); |
josh_ohara | 6:5bea67cc96f9 | 27 | void check_alien_collision(Gamepad &pad) |
josh_ohara | 6:5bea67cc96f9 | 28 | |
josh_ohara | 6:5bea67cc96f9 | 29 | Alien A1; |
josh_ohara | 6:5bea67cc96f9 | 30 | Ship S1; |
josh_ohara | 6:5bea67cc96f9 | 31 | BulletS BS1; |
josh_ohara | 6:5bea67cc96f9 | 32 | |
josh_ohara | 6:5bea67cc96f9 | 33 | int S1_height; |
josh_ohara | 6:5bea67cc96f9 | 34 | int S1_width; |
josh_ohara | 6:5bea67cc96f9 | 35 | int A1_size; |
josh_ohara | 6:5bea67cc96f9 | 36 | int B1_size; |
josh_ohara | 6:5bea67cc96f9 | 37 | |
josh_ohara | 6:5bea67cc96f9 | 38 | int A2y; |
josh_ohara | 6:5bea67cc96f9 | 39 | |
josh_ohara | 6:5bea67cc96f9 | 40 | int S1y; |
josh_ohara | 6:5bea67cc96f9 | 41 | |
josh_ohara | 6:5bea67cc96f9 | 42 | int B1x; |
josh_ohara | 6:5bea67cc96f9 | 43 | |
josh_ohara | 6:5bea67cc96f9 | 44 | Direction D; |
josh_ohara | 6:5bea67cc96f9 | 45 | float Mag; |
josh_ohara | 6:5bea67cc96f9 | 46 | |
josh_ohara | 6:5bea67cc96f9 | 47 | }; |
josh_ohara | 6:5bea67cc96f9 | 48 | |
josh_ohara | 6:5bea67cc96f9 | 49 | #endif |