I'm just messing around with using classes and message boxes, and decided to make program only using pop-ups. How would I make a pop-up like a message box that takes in text input?
This is a console program. I guess I can show some code to give an idea of what I'm trying to create.
Game::Game()
{
Intro();
}
void Game::Intro()
{
MessageBox(NULL, TEXT("Hello, and welcome to your new game. Please give your name."), TEXT("This also isn't final."), MB_OK);
ChooseName();
}
void Game::ChooseName()
{
std::getline(std::cin, PlayerName);
char buff[100];
sprintf_s(buff, "So you're happy with your name being this: %s", PlayerName.c_str());
int MsgBoxID = MessageBox(NULL, buff, TEXT("Just checking if you wanna keep it."), MB_YESNO);
switch (MsgBoxID)
{
case IDYES:
MessageBox(NULL, TEXT("I liked that name anyways."), TEXT("One final precaution."), MB_OK);
break;
case IDNO:
MessageBox(NULL, TEXT("Time for you to choose another name, then."), TEXT("Here's another chance."), MB_OK);
ChooseName();
}
}
void Game::ChooseClass()
{
MessageBox(NULL, TEXT("Now, what class would you like to take on? Would you like to be a Knight, Archer, Wizard, Summoner, Legionist, or Trapper?"), TEXT("Important decision."), MB_OK);
}
I started off replacing cin with the sprintf_s, but I want to go further and make a pop-up like the MessageBox that takes in a string so they can type out what class they want.