Richard Ellingworth / Mbed 2 deprecated RobotRic

Dependencies:   25LCxxx_SPI CommonTypes Gameduino mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HighScoreEntry.h Source File

HighScoreEntry.h

00001 /*
00002  * SOURCE FILE : HighScoreEntry.h
00003  *
00004  * Definition of class HighScoreEntry.
00005  * Routine to allow player to enter their name using joysticks.
00006  *
00007  */
00008 
00009 #ifndef HighScoreEntryDefined
00010 
00011   #define HighScoreEntryDefined
00012 
00013   #include "Types.h"
00014   #include "PanelControls.h"   // for reading panel controls.
00015   #include "PlayerName.h"
00016   #include "Gameduino.h"
00017   #include "FieldGrid.h"       // grid around which cursor moves
00018   
00019   class HighScoreEntry {
00020 
00021   public :
00022 
00023     /***************/
00024     /* CONSTRUCTOR */
00025     /***************/
00026     HighScoreEntry();
00027 
00028     /**************/
00029     /* DESTRUCTOR */
00030     /**************/
00031     virtual ~HighScoreEntry();
00032 
00033     /*********************/
00034     /* GET A PLAYER NAME */
00035     /*********************/
00036     // Pass pointer to place to store name in name.
00037     // Pass pointer to controls to read in controls.
00038     // Pass pointer to Gameduino to display on in gd.
00039     void GetName( PlayerName *name, PanelControls *controls, Gameduino *gd );
00040 
00041 private :
00042 
00043     // Index of character being modified in the name.
00044     UInt8 charIndex;
00045     
00046     // Grid row and column number for cursor.
00047     UInt8 cursorRow, cursorColumn;
00048     
00049     // Grid around which cursor moves.
00050     FieldGrid grid;
00051 
00052     // Some text.
00053     static const char textDelete[];
00054     static const char textEnter[];
00055         
00056     /*******************/
00057     /* INITIALISE GRID */
00058     /*******************/
00059     void InitialiseGrid( void );
00060     
00061     /***************************************/
00062     /* ADD A CELL CONTAINING TEXT TO A ROW */
00063     /***************************************/
00064     // Pass character coordinates in x and y. These will be updated.
00065     // Pass row to which cells should be added in row.
00066     // Pass text which is to be contained in cell in text.
00067     void AddTextCell( UInt8 &x, UInt8 &y, FieldRow *row, const char *text );
00068 
00069     /************************************************************************/
00070     /* PERFORM A SPECIAL FUNCTION TRIGGERED FROM A CELL ON LAST ROW OF GRID */
00071     /************************************************************************/
00072     // Pass pointer to Gameduino to draw on in gd.
00073     // Pass function number in funcNum (this is the cursor column number).
00074     // Pass player name in name.
00075     // Pass reference to done flag in done.
00076     void SpecialFunction( Gameduino *gd, UInt8 funcNum, PlayerName *name, bool &done );
00077 
00078     /*********************/
00079     /* WAIT FOR CONTROLS */
00080     /*********************/
00081     // Pass pointer to Gameduino to display on in gd.
00082     // Pass pointer to controls to read in controls.
00083     // Pass true in waitActivate to wait for a control to be used.
00084     // Pass false to wait for release.
00085     void WaitControls( Gameduino *gd, PanelControls *controls, bool waitActivate );
00086 
00087     /*******************/
00088     /* DRAW THE SCREEN */
00089     /*******************/
00090     // Pass pointer to Gameduino to display on in gd.
00091     // Pass player name in name.
00092     void DrawScreen( Gameduino *gd, PlayerName *name );
00093 
00094     /***************************/
00095     /* DRAW THE CHARACTER GRID */
00096     /***************************/
00097     // Pass pointer to Gameduino to draw on in gd.
00098     void DrawGrid( Gameduino *gd );
00099 
00100     /********************************/
00101     /* DRAW THE NAME AND THE CURSOR */
00102     /********************************/
00103     // Pass pointer to Gameduino to display on in gd.
00104     // Pass player name in name.
00105     void DrawName( Gameduino *gd, PlayerName *name );
00106     
00107     /********************/
00108     /* UPDATE ANIMATION */
00109     /********************/
00110     // Pass pointer to Gameduino to display on in gd.
00111     void Animate( Gameduino *gd );
00112 
00113     /*******************/
00114     /* WIPE THE CURSOR */
00115     /*******************/
00116     // Pass pointer to Gameduino to display on in gd.
00117     // Pass cell to draw in cell.
00118     void WipeCursor( Gameduino *gd, FieldCell *cell );
00119 
00120     /*******************/
00121     /* DRAW THE CURSOR */
00122     /*******************/
00123     // Pass pointer to Gameduino to display on in gd.
00124     // Pass cell to draw in cell.
00125     void DrawCursor( Gameduino *gd, FieldCell *cell );
00126     
00127     /**************************/
00128     /* VALIDATE CURSOR COLUMN */
00129     /**************************/
00130     // If cursor column is beyond end of row then forces it back.
00131     void ValidateCursorColumn( void );
00132     
00133   };
00134 
00135 #endif
00136 
00137 /* END of HighScoreEntry.h */
00138