I couldn't find a good way to phrase the title. Here's what I want to do:
I'm making a text-based game. I currently have it running in console (some code below), and it works just fine for what I have so far. However, I'm making it using #include <iostream>, with mainly cin's and cout's, and I'm going to throw some pointers in for navigation from game squares. My problem with it is that while it works fine in the console, the aesthetics aren't good -- most people would rather play their game in a window than in console. What I need to know is how to make a window with an interactive text box that, depending on the command typed, has a pointer to a different part of the game.
The code I have so far:
#include <iostream>
#include <string>
using namespace std;
int main()
{
char takeDagger;
string input;
cout<<"You wake up and feel light-headed. You try to think of what happened," << endl;
cout<<"but you can't remember anything." << endl;
cout<<"The last thing you recall is walking down the street, and then..." << endl;
cout<<"you woke up here, in what seems to be an abandoned cabin.\n" << endl;
cout<<"You look around and see a worn-down fireplace, full of ashes from a fire" << endl;
cout<<"whose heat was lost to the world long ago.\n" << endl;
cout<<"Above the fireplace you see a rusted dagger. You should probably 'take'.\n" <<endl;
getline(cin, input);
if(input == "take") {
cout<<"You took the dagger\n";
}
else {
cout<<"Invalid command. Please try again." << endl;
}
while (input != "take") {
getline(cin, input);
if(input == "take") {
cout<<"You took the dagger\n";
}
else {
cout<<"Invalid command. Please try again." << endl;
}
}
system("pause>nul");
}
The program is currently just in one square of the game and has the option to take the dagger. If the user types "take", they take the dagger, and the program completes (will later give different text, and start them on the game), and if they type something else, it tells them it's an invalid command, and restarts the asking for a command.
Ok, repost this on the windows programming forum, because that would be what you are asking for help on, but I don't know how to write a text-based windows program.
What you can do is include windows.h, write yourself a ClearScreen function, make yourself ASCII images, change text colors,and use conio.h to get arrow inputs (see http://www.cplusplus.com/forum/beginner/77350/ for a good example).
People have been saying that this counts as a windows game, so if I helped you in the way you were looking for, don't bother reposting.
That's not what I was asking about. I know how to get all that working, and colored ASCII makes there be "images". I don't want Dwarf Fortress, I want text only. The fact is that it's still in console, just with the ASCII images.
I want a screen to pop up using <windows.h>, like it would in any other game. From there, I want the game to run console-like, just not in console.