Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.45 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. ////                                                                                                    ////
  3. ////        Name:       game.h                                                                          ////
  4. ////                                                                                                    ////
  5. ////        Purpose:    establishing the game class                                                     ////
  6. ////                                                                                                    ////
  7. ////        Author:     Sebastian Toy                                                                   ////
  8. ////                                                                                                    ////
  9. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. // the new way of making sure this is accessed only once
  12. #pragma once
  13.  
  14. #define MAX_LINE_CHAR  37       // there will be 37 lines set aside for guessing the real number
  15. #define MAX_LINE_WIDTH 50       // 50 characters are allocated per line
  16.  
  17. // like a struct only different, more on this later
  18. class Game : public Window {
  19. public:
  20.     // game functions
  21.     void setUpGame(int a_width, int a_height);      // initialize the variables
  22.     void mainGameLoop();                            // this is the game
  23.     void drawMenuChoices(int a_lineNum);            // draw the 'a' to 'c' choices in white or green
  24.     void refreshLines();                            // print all the lines with guesses in them
  25.     void refreshBorder(int a_width, int a_height);  // Refresh the border if the player overwrites it
  26.     int findArrayLength(char a_array[]);
  27.     enum eInput { NUM, NUM_RANGE, CHAR };
  28.     int interceptInput
  29.     (int a_lineNum, int a_lineDrawPoint, int a_maxDigits, char a_validChars[], int a_validCharLength, eInput a_inputType, int a_minRange = 0, int a_maxRange = 0); // Stop the player from entering in garbage  
  30.     void pauseTillEscapeHit();                      // wait ...
  31. private:
  32.     // game data
  33.     int mMaxGuess;                                  // current high guess
  34.     int mMinGuess;                                  // current low guess
  35.  
  36.     bool mGameOver;                                 // is game over
  37.     bool gQuitGame;                                 // quit the game
  38.     int mLinesX;                                    // x location where the numbers are entered
  39.     int mAdviceX;                                   // x location where the high or low is mentioned
  40.     int mMaxNum;                                    // maximum number
  41.     int mGuessNum;                                  // current number to guess
  42.     char mGameType;                                 // game type 'a' 'b' or 'c'
  43.     char mLines[MAX_LINE_CHAR][MAX_LINE_WIDTH];     // lines for the entries
  44.     int mCurrentLineNumber;                         // current line you are up to
  45.     int guessNumber;                                // current number of guesses
  46.                                                     // Valid character inputs
  47.     char validModes[4] = { 'a', 'b', 'c', NULL };
  48.     char validGuesses[3] = { 'l', 'h', NULL };
  49.     char numbers[11] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', NULL };
  50. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement