• Advertisement
Sign in to follow this  

[C++] Cross platform text console?

This topic is 2563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

I've currently been toying quite a bit with the idea of a console window text based game.

My target platforms will be the Windows PC and also Linux PC.

Currently I have a 2d array that works as a sort of screen buffer.



string the_buffer[x][y]; // string buffer lets us use either unicode or ascii single characters between OSs

for(char y = 0; y < 20; y++)
{
for(char x = 0; x < 64; x++)
{
// add string value to current line
cout << the_buffer[x][y];
}
// move to next line
cout << endl;
}


Now I have everything drawing to the screen but I would like a platform independent way to keep blitting the buffer's contents to the screen. Also there must be some form of verticle synchronization so the screen does not have flashing and missing lines as the buffer refreshes.

Also, I ask the veterans of character based games, what do I need to look out for when making a cross platform solution with the console window?

Share this post


Link to post
Share on other sites
Advertisement
I would actually recommend Java for a project like this as it's made to be portable across platforms and the usual reasons people don't use Java for games (speed, memory usage, what have you) are a non-issue in a text-based game. You can do it in C/C++, of course, but you'll have to compile it for each system. That's not so bad, of course, but using something like Java trivializes it for you. =)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement