Missile Command Game
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
hardware.h@2:a09accf52491, 2022-07-23 (annotated)
- Committer:
- bpritchettjr
- Date:
- Sat Jul 23 03:28:14 2022 +0000
- Revision:
- 2:a09accf52491
- Parent:
- 0:09aa1ecd6c39
Final game
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lwills | 0:09aa1ecd6c39 | 1 | #ifndef HARDWARE_H |
lwills | 0:09aa1ecd6c39 | 2 | #define HARDWARE_H |
lwills | 0:09aa1ecd6c39 | 3 | |
lwills | 0:09aa1ecd6c39 | 4 | /** |
lwills | 0:09aa1ecd6c39 | 5 | * Structure that represents all the inputs to the game. |
lwills | 0:09aa1ecd6c39 | 6 | * If additional hardware is added, new elements should be added to this struct. |
lwills | 0:09aa1ecd6c39 | 7 | */ |
lwills | 0:09aa1ecd6c39 | 8 | struct GameInputs { |
lwills | 0:09aa1ecd6c39 | 9 | int b1, b2, b3; // Button presses |
lwills | 0:09aa1ecd6c39 | 10 | double ax, ay, az; // Accelerometer readings |
lwills | 0:09aa1ecd6c39 | 11 | }; |
lwills | 0:09aa1ecd6c39 | 12 | |
lwills | 0:09aa1ecd6c39 | 13 | /** |
lwills | 0:09aa1ecd6c39 | 14 | * Initialize all the hardware. |
lwills | 0:09aa1ecd6c39 | 15 | */ |
lwills | 0:09aa1ecd6c39 | 16 | int hardware_init(); |
lwills | 0:09aa1ecd6c39 | 17 | |
lwills | 0:09aa1ecd6c39 | 18 | /** |
lwills | 0:09aa1ecd6c39 | 19 | * Read all the user inputs. |
lwills | 0:09aa1ecd6c39 | 20 | * This is all input hardware interaction should happen. |
lwills | 0:09aa1ecd6c39 | 21 | * Returns a GameInputs struct that has all the inputs recorded. |
lwills | 0:09aa1ecd6c39 | 22 | * This GameInputs is used elsewhere to compute the game update. |
lwills | 0:09aa1ecd6c39 | 23 | */ |
lwills | 0:09aa1ecd6c39 | 24 | GameInputs read_inputs(); |
lwills | 0:09aa1ecd6c39 | 25 | |
lwills | 0:09aa1ecd6c39 | 26 | #endif // HARDWARE_H |