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

Dependents:   200943412_QuickClick

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Display.h Source File

Display.h

00001 #ifndef DISPLAY_H
00002 #define DISPLAY_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h" 
00006 #include "Controller.h"
00007 
00008 /** Display Class
00009 @brief This class encapsulates all the algorithms required for the displaying strings and time dependant patterns on the lcd.
00010 @author Dominic Kay
00011 
00012 @date April 2017
00013 */
00014 class Display
00015 {
00016 
00017 public:
00018    
00019    /** Constructor */
00020     Display(); 
00021     
00022     /** Destructor */
00023     ~Display();
00024     
00025     /** Sets all variables to zero and resets wait time to max value */
00026     void init();
00027     
00028     /** Method for drawing the circle and decreasing the wait time */
00029     void drawCircle(Controller &ctrl, N5110 &lcd); 
00030     
00031     
00032     /**
00033      * @brief Method for resetting the wait time if multi-player 
00034      * @param class variable w
00035      * @return void
00036      */  
00037     void put_wait(float w); 
00038     
00039     /**
00040      * @brief Method for getting the wait time if multi-player 
00041      * @return wait time
00042      */ 
00043     float get_wait(); 
00044     
00045     /**
00046      * @brief Displays a random instruction for the user to perform 
00047      * @param ran (random number generated from operator)
00048      * @return void
00049      */
00050     void display_instruction(N5110 &lcd, int ran);   
00051 
00052      
00053 private:
00054       
00055      /** Methord for the mathematical operation behind the change in time before gameover */
00056     void _calculateWait();
00057     
00058     /** 
00059     @brief Method allowing one octant to be displayed at one time. Also allows interaction with controller for flashing screen and sounds 
00060     @param id[in] void
00061     @return interger used in for loop (representing number of loops) 
00062     */
00063     void _arc_selector(Controller &ctrl, N5110 &lcd); 
00064     
00065     /**
00066      * @brief An algorithm that draws the eight octants of a circle pixel by pixel.
00067      * @param id[in] interger used in for loop from Circle() Methord
00068      * @return void
00069      */
00070     void _drawArc(N5110 &lcd, int a); 
00071     
00072     int _h;             // <<score / number of full circle performed      
00073     float _w;           // <<wait time 
00074     int _a;             // <<for loop variable 
00075     int _x;              // <<radius of circle
00076     int _y;              // <<y co-ordinate 
00077     int _x0;             // <<variable used to modify x
00078     int _y0;             // <<variable used to modify y
00079     int _radiusMod;      // <<1 - the radius of the circle
00080     
00081 
00082 };
00083 #endif