This question may be somewhat trivial, but I'm stumped none the less.
The goal is to create a 'selection box' on the screen such as for selecting units in an rts game.
I'll just give the pseudo-code, its the idea that's important
main loop is set up as such:
while(!quit_game){
if(mouse_b &1)
delay timer
if(mouse_b &1) //the button is still pressed
drag_leftclick();
else
single_leftclick();
//check other inputs
//update game logic
//draw stuff
}
now, inside the drag_leftclick() function, it has to wait in a while loop until you release the button, record the x,y before and after coordinates and go about business. The problem is this completely freezes the rest of program while it waits for the user to finish selecting.
I've a pretty good grasp on c++ but still learning. I strongly suspect the answer involves multithreading. Does anyone have other suggestions?? And does anyone know a good intro to multithreading, if not for this, for sometime later?
Thanks all