Added HangmanGame class, but does not work yet
Dependencies: SDFileSystem app epson mbed msp430 pl tests
Revision 1:a5ec6f9dcf0d, committed 2017-12-04
- Comitter:
- markpsymonds
- Date:
- Mon Dec 04 20:15:18 2017 +0000
- Parent:
- 0:fa7450a43b99
- Commit message:
- Fixed most compile issues in hangman.cpp/.h.
Changed in this revision
hangman.cpp | Show annotated file Show diff for this revision Revisions of this file |
hangman.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/hangman.cpp Mon Dec 04 09:32:20 2017 +0000 +++ b/hangman.cpp Mon Dec 04 20:15:18 2017 +0000 @@ -2,13 +2,15 @@ #include "log.h" +#include "hangman.h" + namespace Flexbook { -Flexbook::HangmanGame() -: word, guessed, - alphabet, - wordlength, currentpos, oldpos, hangstage +HangmanGame::HangmanGame() +: finished(false), word(""), guessed(""), + wordlength(0), currentpos(), oldpos(), + alphabet(), hangstage() { Log("Creating hangman game"); // Display the game welcome screen @@ -27,7 +29,7 @@ // Display the game start screen } -Flexbook::RedrawAlphabet(char newpos, char oldpos) +void HangmanGame::RedrawAlphabet(char newpos, char oldpos) { // redraw the alphabet matrix based on a cursor move }
--- a/hangman.h Mon Dec 04 09:32:20 2017 +0000 +++ b/hangman.h Mon Dec 04 20:15:18 2017 +0000 @@ -24,20 +24,22 @@ ~HangmanGame(); // Game status indicator - boolean finished = false; + bool finished; private: // Word to be guessed, word guessed so far - char[14] word, guessed; + char word[14]; + char guessed[14]; // Number of letters in word to be guessed char wordlength; // Currently selected and previous position on the alphabet matrix - char currentpos, oldpos; + char currentpos; + char oldpos; // Status indicator for each letter on the alphabet matrix, already used or not? - boolean[27] alphabet; + bool alphabet[27]; // Number of wrong guesses, equals number of elements of hanging man drawn char hangstage; @@ -49,7 +51,7 @@ void select(); // Routine to redraw the alphabet matrix after a cursor move - void redrawalphabet(char newpos, char oldpos); + void RedrawAlphabet(char newpos, char oldpos); };