Quote:Original post by Paulius Maruska
Quote:Original post by gharen2
Or, have the thread sleep a millisecond each frame.
I'd, actually, recommend sleeping a little longer. You don't really need to update that often, when the game is minimized - 10 updates per second would be more than enough, IMO.
I set it to 1ms, but I don't really see how making it larger make a difference, it reminds me of 'DoEvents' from vb6, back when I used sleep as my timer :)
Quote:Original post by Colin Jeanne
As for HWND window - as long as the threads arent writing to that variable (which they probably arent) you should be ok. The real problem occurs when either two threads try to write a variable at the same time or one is writing while the other is reading. If both are reading, that's fine.
I see, how about when the window is being resized, would that modify the hwnd? Because I am always checking the size of the window for the projection matrix and buffer width/height to use in resetting the d3d device.
Quote:Original post by Anon Mike
Is your game thread doing UI stuff or is it just logic? If it's doing UI stuff there's not really any point in running it on a different thread then the message loop.
Just logic, though I did it only because when you drag, resize or right click the title bar on the window the game would stop because of the message loop,
and when the game loop started running again the game objects would jump forward a couple of seconds, I managed to zero the timer on everything but right clicking on the title bar, I couldn't work out how to detect that.
I am a bit apprehensive about using threads for something like that, but it really bugged me.
Also something else, d3d device seems to get lost if you minimize for more than a couple of seconds, it never did that when I used only the default thread, it is being handled but I'm wondering why it is lost so easily now?
Thanks alot guys.