This class is the engine of the program. It encapsulates all the methods to do with managing scores, commands and player states(dead/alive).
Operator.h@7:5d9b9d0bc6e7, 2017-04-16 (annotated)
- Committer:
- domkay97
- Date:
- Sun Apr 16 19:37:55 2017 +0000
- Revision:
- 7:5d9b9d0bc6e7
- Parent:
- 6:9882809b0694
- Child:
- 8:93f18f1c1241
Tidying up and changing string positions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
domkay97 | 0:3097759acb02 | 1 | #ifndef OPERATOR_H |
domkay97 | 0:3097759acb02 | 2 | #define OPERATOR_H |
domkay97 | 0:3097759acb02 | 3 | |
domkay97 | 0:3097759acb02 | 4 | #include "mbed.h" |
domkay97 | 0:3097759acb02 | 5 | #include "N5110.h" |
domkay97 | 0:3097759acb02 | 6 | #include "Display.h" |
domkay97 | 1:0f98beb0993b | 7 | #include "Controller.h" |
domkay97 | 0:3097759acb02 | 8 | |
domkay97 | 0:3097759acb02 | 9 | class Operator |
domkay97 | 0:3097759acb02 | 10 | { |
domkay97 | 0:3097759acb02 | 11 | |
domkay97 | 7:5d9b9d0bc6e7 | 12 | public: |
domkay97 | 7:5d9b9d0bc6e7 | 13 | |
domkay97 | 7:5d9b9d0bc6e7 | 14 | /**Contructor*/ |
domkay97 | 0:3097759acb02 | 15 | Operator(); |
domkay97 | 7:5d9b9d0bc6e7 | 16 | |
domkay97 | 7:5d9b9d0bc6e7 | 17 | /**Destructor*/ |
domkay97 | 0:3097759acb02 | 18 | ~Operator(); |
domkay97 | 0:3097759acb02 | 19 | |
domkay97 | 0:3097759acb02 | 20 | |
domkay97 | 7:5d9b9d0bc6e7 | 21 | /** |
domkay97 | 7:5d9b9d0bc6e7 | 22 | * @brief generates a random interger to be used in the display class to represent an instruction |
domkay97 | 7:5d9b9d0bc6e7 | 23 | * @return void random interger |
domkay97 | 7:5d9b9d0bc6e7 | 24 | */ |
domkay97 | 7:5d9b9d0bc6e7 | 25 | int random_instruction(Display &display, N5110 &lcd); |
domkay97 | 7:5d9b9d0bc6e7 | 26 | |
domkay97 | 7:5d9b9d0bc6e7 | 27 | /** Methord performed when the user performs the right instruction on time, score is increased, lighting and sound performed.*/ |
domkay97 | 7:5d9b9d0bc6e7 | 28 | void Correct(Controller &ctrl); |
domkay97 | 5:84dfbfb17ef2 | 29 | |
domkay97 | 7:5d9b9d0bc6e7 | 30 | /** Methord performed when the user is too slow or performs the wrong instruction, score is displayed, game ends */ |
domkay97 | 7:5d9b9d0bc6e7 | 31 | void Game_Over(Controller &ctrl, N5110 &lcd); |
domkay97 | 7:5d9b9d0bc6e7 | 32 | |
domkay97 | 7:5d9b9d0bc6e7 | 33 | private: |
domkay97 | 7:5d9b9d0bc6e7 | 34 | /** This methord displays and assesses score and display a performace rating for user to see.*/ |
domkay97 | 7:5d9b9d0bc6e7 | 35 | void Assessment(N5110 &lcd, int score); |
domkay97 | 7:5d9b9d0bc6e7 | 36 | |
domkay97 | 7:5d9b9d0bc6e7 | 37 | float freq_change; |
domkay97 | 7:5d9b9d0bc6e7 | 38 | int score; // <score to indentify users progress through game |
domkay97 | 3:7213eee4c093 | 39 | |
domkay97 | 0:3097759acb02 | 40 | |
domkay97 | 0:3097759acb02 | 41 | }; |
domkay97 | 0:3097759acb02 | 42 | |
domkay97 | 0:3097759acb02 | 43 | #endif |