This class encapsulates all the algorithms required for the displaying strings and time dependent patterns on the lcd.

Dependents:   200943412_QuickClick

Committer:
domkay97
Date:
Sun Apr 23 16:36:26 2017 +0000
Revision:
14:dd1f98f7d43a
Parent:
12:41e9ba6d65d3
Child:
16:8d158d39d438
Updated comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
domkay97 0:dd78eca4b004 1 #ifndef DISPLAY_H
domkay97 0:dd78eca4b004 2 #define DISPLAY_H
domkay97 0:dd78eca4b004 3
domkay97 0:dd78eca4b004 4 #include "mbed.h"
domkay97 9:1e25dcab4927 5 #include "N5110.h"
domkay97 9:1e25dcab4927 6 #include "Controller.h"
domkay97 1:41a1c20a2056 7
domkay97 0:dd78eca4b004 8 class Display
domkay97 0:dd78eca4b004 9 {
domkay97 0:dd78eca4b004 10
domkay97 0:dd78eca4b004 11 public:
domkay97 11:7ad2ea427784 12
domkay97 11:7ad2ea427784 13 /** Constructor */
domkay97 11:7ad2ea427784 14 Display();
domkay97 11:7ad2ea427784 15
domkay97 11:7ad2ea427784 16 /** Destructor */
domkay97 0:dd78eca4b004 17 ~Display();
domkay97 11:7ad2ea427784 18
domkay97 11:7ad2ea427784 19 /** Sets all variables to zero and resets wait time to max value */
domkay97 0:dd78eca4b004 20 void init();
domkay97 11:7ad2ea427784 21
domkay97 14:dd1f98f7d43a 22 /** Method for drawing the circle and decreasing the wait time */
domkay97 11:7ad2ea427784 23 void drawCircle(Controller &ctrl, N5110 &lcd);
domkay97 11:7ad2ea427784 24
domkay97 12:41e9ba6d65d3 25
domkay97 14:dd1f98f7d43a 26 /**
domkay97 14:dd1f98f7d43a 27 * @brief Methord for resetting the wait time if multi-player
domkay97 14:dd1f98f7d43a 28 * @param class variable w
domkay97 14:dd1f98f7d43a 29 * @return void
domkay97 14:dd1f98f7d43a 30 */
domkay97 12:41e9ba6d65d3 31 void put_wait(float w);
domkay97 12:41e9ba6d65d3 32
domkay97 14:dd1f98f7d43a 33 /**
domkay97 14:dd1f98f7d43a 34 * @brief Method for getting the wait time if multi-player
domkay97 14:dd1f98f7d43a 35 * @return wait time
domkay97 14:dd1f98f7d43a 36 */
domkay97 12:41e9ba6d65d3 37 float get_wait();
domkay97 12:41e9ba6d65d3 38
domkay97 14:dd1f98f7d43a 39 /**
domkay97 11:7ad2ea427784 40 * @brief Displays a random instruction for the user to perform
domkay97 14:dd1f98f7d43a 41 * @param ran random number generated from operator
domkay97 11:7ad2ea427784 42 * @return void
domkay97 11:7ad2ea427784 43 */
domkay97 6:8840d7e48ce7 44 void display_instruction(N5110 &lcd, int ran);
domkay97 11:7ad2ea427784 45
domkay97 11:7ad2ea427784 46 /** Methord for the mathematical operation behind the change in time before gameover */
domkay97 6:8840d7e48ce7 47 void calculateWait();
domkay97 0:dd78eca4b004 48
domkay97 0:dd78eca4b004 49
domkay97 0:dd78eca4b004 50 private:
domkay97 11:7ad2ea427784 51
domkay97 11:7ad2ea427784 52 /**
domkay97 11:7ad2ea427784 53 @brief Methord allowing one octant to be displayed at one time. Also allows interaction with controller for flashing screen and sounds
domkay97 11:7ad2ea427784 54 @param id[in] void
domkay97 11:7ad2ea427784 55 @return interger used in for loop (representing nember of loops)
domkay97 11:7ad2ea427784 56 */
domkay97 11:7ad2ea427784 57 void Circle(Controller &ctrl, N5110 &lcd);
domkay97 11:7ad2ea427784 58
domkay97 11:7ad2ea427784 59 /**
domkay97 11:7ad2ea427784 60 * @brief An algorithm that draws the eight octants of a circle pixel by pixel
domkay97 11:7ad2ea427784 61 * @param id[in] interger used in for loop from Circle() Methord
domkay97 11:7ad2ea427784 62 * @return void
domkay97 11:7ad2ea427784 63 */
domkay97 11:7ad2ea427784 64 void Drawarc(N5110 &lcd, int a);
domkay97 11:7ad2ea427784 65
domkay97 11:7ad2ea427784 66 int _h; // <<number of arcs displayed
domkay97 11:7ad2ea427784 67 float _w; // <<wait time
domkay97 11:7ad2ea427784 68 int _a; // <<for loop variable
domkay97 11:7ad2ea427784 69 int _v; // <<interger to tell class which random instuction to perform
domkay97 11:7ad2ea427784 70 int x; // <<radius of circle
domkay97 11:7ad2ea427784 71 int y; // <<y co-ordinate
domkay97 11:7ad2ea427784 72 int x0; // <<variable used to modify x
domkay97 11:7ad2ea427784 73 int y0; // <<variable used to modify y
domkay97 11:7ad2ea427784 74 int radiusMod; // <<1 - the radius of the circle
domkay97 11:7ad2ea427784 75
domkay97 0:dd78eca4b004 76
domkay97 0:dd78eca4b004 77 };
domkay97 0:dd78eca4b004 78 #endif