Last active
August 29, 2015 14:10
-
-
Save Seth-Johnson/aae9db059267737bbc0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void startGame() { | |
int theRandomNumber = 90; /* getRandomNumber(); */ | |
// snip | |
} | |
// startGame() is called when the button is pressed, followed by checkNumber() | |
void checkNumber() { | |
wchar_t currentGuessBuffer[4] = { 4 }; | |
SendMessage(g_hEdit_Answer, EM_GETLINE, NULL, (LPARAM)currentGuessBuffer); | |
SendMessage(g_hLabelInfo2, WM_SETTEXT, 0, (LPARAM)currentGuessBuffer); | |
if (std::wstring(currentGuessBuffer).compare(std::to_wstring(theRandomNumber)) == 0) { | |
// call the winner function! | |
SendMessage(g_hLabelInfo2, WM_SETTEXT, 0, (LPARAM)L"You win!"); // for testing | |
//(int)currentGuessBuffer; | |
} | |
else { | |
// call the not winner function :( | |
SendMessage(g_hLabelInfo2, WM_SETTEXT, 0, (LPARAM)L"Your guess was" + wchar_t(currentGuessBuffer)); // for testing | |
} | |
} | |
void processButtonPress() { | |
wchar_t currButtonTextBuffer[11]; | |
SendMessage(g_hSubmit_Answer, WM_GETTEXT, 11, (LPARAM)currButtonTextBuffer); | |
if (std::wstring(currButtonTextBuffer).compare(std::wstring(L"GUESS")) == 0) { | |
checkNumber(); | |
} | |
else if (std::wstring(currButtonTextBuffer).compare(std::wstring(L"pressed")) == 0) { | |
checkNumber(); | |
} | |
else if (currButtonTextBuffer == L"Start Game") { | |
// TBI (to be implemented) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment