Skip to main content
gamedev.net
🔒 Locked

Command Line + OpenGL/SDL

Started by Verminox Dec 26, 2006 at 7:08 AM 1 replies 800+ views
Original Post
Verminox
Verminox
I'm making a C++ program using OpenGL/SDL for graphics, but I want to be able to interact with the user using a command line interface. I don't know if this is what is meant by Multi-Threading, because I havn't read much about it, but basically I want there to be two windows open at once: 1. The terminal window from where the app was started that will ask for inputs and output results/messages/exceptions. 2. The OpenGL/SDL window that displays the GFX. Note that I must be able to communicate between the two processes. A user input in the terminal should be processed by the program, and effectively modify the GFX display. Similarly, any OpenGL/SDL exceptions, etc. should be reported back via the terminal. How would I go around doing this? Note: Just including and then doing the terminal stuff and rendering in the same loop is not what I am looking for. For example, when I ask for user input with cin I don't want the rendering to halt, I just want both tasks running simultaneously, and communicating by sending each other events/statuses.
--------------------------------------Amaze your friends! Astound your family! Kennify your text!
clb
clb
Yeah, creating two threads for this might be a good idea. Just read documentations and don't throw yourself at coding rightaway. Multithreading can catch you easily if you're unaware of what's going on.

Also, I'm not sure if this hits your preferred platform, but it might be useful:
MSDN reference: Console Functions

EDIT: Of course, you could go another route and try making a non-modal input processing, but with iostreams that mightn't be so funny.
Verminox
Verminox
Nope, I'm on Ubuntu Linux. But, isn't there any platform independent way of just splitting one program into two?

I wouldn't even mind if they were two separate processes which could send each other signals, doesn't have to be the same program, but anything that can easiyl separate the console from the gfx.

I tried google to get more information on Multi-threading in C++, but I'm afraid to say I didn't find any of them worth it... let alone understandable.
--------------------------------------Amaze your friends! Astound your family! Kennify your text!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.