views:

37

answers:

2

So the story goes, I have an sdl/c++/opengl/win32 program which has a window to display my graphics and a console to get user input. When I tell the console to get input the display will go into a "Not Responding" mode. The program is single threaded and I was hoping that there was a better way around the problem then creating a multi-process program.

This honestly isn't a large problem, but it is one of those small pet peeves that just makes you stay up all night digging into the internet for a solution.

A: 

You need to run the window updates/opengl drawing code and the console input in different threads, when you are waiting for input in the console it blocks everything else so the window can't respond to window events.

I would recommend you take a look at the boost thread library, I've found that to be very simple and straight forward to use.

Daniel
A: 

cin is blocking your process. Use SDL's keyboard messages to emulate similar functionality.

genpfault