Menu class used as basis for program; running the game and allowing the user to change the style and difficulty of the game via an interface.
Menu.h@4:4f20bcef2c0c, 2017-05-01 (annotated)
- Committer:
- el15mh
- Date:
- Mon May 01 09:13:40 2017 +0000
- Revision:
- 4:4f20bcef2c0c
- Parent:
- 3:a79daa7c2b55
- Child:
- 5:56f13954666e
game with random maze index generation;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el15mh | 0:b32f6570a26d | 1 | /* |
el15mh | 1:21b7a5edb9c2 | 2 | |
el15mh | 1:21b7a5edb9c2 | 3 | @file Menu.h |
el15mh | 1:21b7a5edb9c2 | 4 | |
el15mh | 1:21b7a5edb9c2 | 5 | (c) Max Houghton 02.14.17 |
el15mh | 1:21b7a5edb9c2 | 6 | Roller Maze Project, ELEC2645, Univeristy of Leeds |
el15mh | 1:21b7a5edb9c2 | 7 | |
el15mh | 1:21b7a5edb9c2 | 8 | */ |
el15mh | 0:b32f6570a26d | 9 | |
el15mh | 0:b32f6570a26d | 10 | #ifndef MENU_H |
el15mh | 0:b32f6570a26d | 11 | #define MENU_H |
el15mh | 0:b32f6570a26d | 12 | |
el15mh | 4:4f20bcef2c0c | 13 | #include <stdlib.h> // used to generate random number values |
el15mh | 4:4f20bcef2c0c | 14 | |
el15mh | 0:b32f6570a26d | 15 | #include "mbed.h" |
el15mh | 0:b32f6570a26d | 16 | #include "N5110.h" |
el15mh | 0:b32f6570a26d | 17 | #include "Gamepad.h" |
el15mh | 2:917211a4551b | 18 | #include "MazeEngine.h" |
el15mh | 3:a79daa7c2b55 | 19 | #include "Animations.h" |
el15mh | 2:917211a4551b | 20 | #include "Maze.h" |
el15mh | 2:917211a4551b | 21 | #include "Ball.h" |
el15mh | 0:b32f6570a26d | 22 | |
el15mh | 0:b32f6570a26d | 23 | class Menu |
el15mh | 0:b32f6570a26d | 24 | { |
el15mh | 2:917211a4551b | 25 | |
el15mh | 0:b32f6570a26d | 26 | public: |
el15mh | 0:b32f6570a26d | 27 | |
el15mh | 0:b32f6570a26d | 28 | Menu(); |
el15mh | 0:b32f6570a26d | 29 | ~Menu(); |
el15mh | 0:b32f6570a26d | 30 | |
el15mh | 3:a79daa7c2b55 | 31 | void init(); |
el15mh | 4:4f20bcef2c0c | 32 | void main(N5110 &lcd, |
el15mh | 4:4f20bcef2c0c | 33 | Gamepad &pad, |
el15mh | 4:4f20bcef2c0c | 34 | FXOS8700CQ &device, |
el15mh | 4:4f20bcef2c0c | 35 | Animations &animate); |
el15mh | 4:4f20bcef2c0c | 36 | |
el15mh | 4:4f20bcef2c0c | 37 | void intro(N5110 &lcd, Gamepad &pad, Animations &animate); |
el15mh | 0:b32f6570a26d | 38 | |
el15mh | 0:b32f6570a26d | 39 | private: |
el15mh | 2:917211a4551b | 40 | |
el15mh | 4:4f20bcef2c0c | 41 | void printGameParameters(int mazeIndex, |
el15mh | 4:4f20bcef2c0c | 42 | int x, |
el15mh | 4:4f20bcef2c0c | 43 | int y, |
el15mh | 4:4f20bcef2c0c | 44 | int radius, |
el15mh | 4:4f20bcef2c0c | 45 | bool control, |
el15mh | 4:4f20bcef2c0c | 46 | bool colour, |
el15mh | 4:4f20bcef2c0c | 47 | float FPS); |
el15mh | 4:4f20bcef2c0c | 48 | |
el15mh | 4:4f20bcef2c0c | 49 | void playGame(N5110 &lcd, |
el15mh | 4:4f20bcef2c0c | 50 | Gamepad &pad, |
el15mh | 4:4f20bcef2c0c | 51 | FXOS8700CQ &device, |
el15mh | 4:4f20bcef2c0c | 52 | Animations &animate, |
el15mh | 4:4f20bcef2c0c | 53 | int mazeIndex, |
el15mh | 4:4f20bcef2c0c | 54 | bool tone, |
el15mh | 4:4f20bcef2c0c | 55 | float FPS); |
el15mh | 4:4f20bcef2c0c | 56 | |
el15mh | 4:4f20bcef2c0c | 57 | void options(N5110 &lcd, Gamepad &pad, Animations &animate, bool tone); |
el15mh | 4:4f20bcef2c0c | 58 | void lcdSettings(N5110 &lcd, Gamepad &pad, Animations &animate); |
el15mh | 4:4f20bcef2c0c | 59 | void soundSettings(N5110 &lcd, Gamepad &pad, Animations &animate); |
el15mh | 4:4f20bcef2c0c | 60 | void controlOptions(N5110 &lcd, Gamepad &pad, Animations &animate); |
el15mh | 4:4f20bcef2c0c | 61 | void difficultyOptions(N5110 &lcd, Gamepad &pad); |
el15mh | 4:4f20bcef2c0c | 62 | void ballColourOptions(N5110 &lcd, Gamepad &pad, Animations &animate); |
el15mh | 4:4f20bcef2c0c | 63 | void lcdInverseColour(N5110 &lcd, Gamepad &pad); |
el15mh | 4:4f20bcef2c0c | 64 | void lcdBackgroundColour(N5110 &lcd, Gamepad &pad, Animations &animate); |
el15mh | 4:4f20bcef2c0c | 65 | |
el15mh | 4:4f20bcef2c0c | 66 | void animateJoystick(N5110 &lcd, Animations &animate); |
el15mh | 4:4f20bcef2c0c | 67 | void animateGamepad(N5110 &lcd, Animations &animate); |
el15mh | 4:4f20bcef2c0c | 68 | void animateStickman(N5110 &lcd, Gamepad &pad, Animations &animate); |
el15mh | 4:4f20bcef2c0c | 69 | |
el15mh | 4:4f20bcef2c0c | 70 | void soundEffects(N5110 &lcd, Gamepad &pad, Animations &animate); |
el15mh | 4:4f20bcef2c0c | 71 | void speedSettings(N5110 &lcd, Gamepad &pad); |
el15mh | 4:4f20bcef2c0c | 72 | |
el15mh | 4:4f20bcef2c0c | 73 | int randomMazeIndexGenerator(int mazeIndex); |
el15mh | 4:4f20bcef2c0c | 74 | |
el15mh | 2:917211a4551b | 75 | MazeEngine _engine; |
el15mh | 2:917211a4551b | 76 | |
el15mh | 2:917211a4551b | 77 | int _mazeIndex; |
el15mh | 4:4f20bcef2c0c | 78 | |
el15mh | 4:4f20bcef2c0c | 79 | float _FPS; |
el15mh | 4:4f20bcef2c0c | 80 | |
el15mh | 3:a79daa7c2b55 | 81 | bool _control; |
el15mh | 3:a79daa7c2b55 | 82 | bool _colour; |
el15mh | 4:4f20bcef2c0c | 83 | bool _goal; |
el15mh | 4:4f20bcef2c0c | 84 | bool _tone; |
el15mh | 2:917211a4551b | 85 | |
el15mh | 0:b32f6570a26d | 86 | }; |
el15mh | 0:b32f6570a26d | 87 | |
el15mh | 2:917211a4551b | 88 | #endif /* MENU_H */ |