Real Software Forums

Game engine
Page 1 of 1

Author:  NaNdummy [ Sun Aug 26, 2012 3:09 am ]
Post subject:  Game engine

Hi guys! Im gonna create a game engine! But i have a question:

I created an update sub in a thread so events still fire. But you shouldnt change the gui from the thread. No, i cant just use a timer which does redraw in the main thread because then it would be a fixed update, not an update. Is it possible?


Author:  BrunoFrechette [ Mon Aug 27, 2012 7:31 pm ]
Post subject:  Re: Game engine

I would still put it in a timer. Make the timer with a small period (maybe 100 ms). Have the timer read a global boolean variable stored somewhere that acts as a flag. When the timer runs, it reads the flag. If the flag is false, do nothing - nothing gets updated. If the flag is true, it updates the gui an sets the flag to false.

This way, anytime you need to update the gui, be it from a thread or anywhere, just set the flag to true and the next timer run will update it.

Author:  simulanics [ Sun Jan 06, 2013 2:53 pm ]
Post subject:  Re: Game engine

goto great white software...the "wheel" has already been invented for you ;-) there's a great game engine class available...

or save your money and goto

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group