-
Multiple Windows
I want to write a command line program the utilizes two windows, so user can look at data side by side
I'm writing a command line game
I want one window to essentially be the entire game, while the other window displays a map of the users location
Or perhaps think of a tic tac toe game
The left window would be where the user decides to place their piece, and the right window would constantly display the board
I could write two programs
A tic tac toe program and a display program
The main game program sends information about the board to the display program which then displays it. But I would really like to be able to do this with one .c file and without using graphics.
-
Why would you make this a command line program. Just make a Win32 project. Also, instead of two different programs, just make one that consists of a main window and a child window. If you made them separate, making them communicate could get messy unless you do some strategic programming.
By the way, do you have a question or something?
-
My question is how do I get two windows?
It has to be a command line program
-
There is no such thing as multiple windows in a Windows console program. You could of course use "textgraphics" to provide a "split screen" - so you have a box at the top of the screen and another one at the bottom. This is far from trivial, but possible. You would need to use the Windows Console functions or some third party (pdCurses perhaps).
--
Mats
-
You could write two programs that work independently of one another in a sort of client/host fashion in order to share data. You could also write a program that just directly alters memory from the other. Long story short, the ends just simply do not justify the means. You are asking the equivalent how can I drive two cars simultaneously.
Far be it for any of us to utter the words "impossible." But its somewhat of a fool's venture.
-
Hold on, actually. If this is an assignment for a class that demands you write in a console, perhaps you can bend the rules instead of breaking them altogether. You can certainly register a window class within a console app. Thus you could have your second window without breaking the cardinal rule in front of you.
Perhaps you could even take a vastly more liberal view of this rule and write your own psuedo-console for your game to run in.