Delta timing with MaxGUI

BlitzMax Forums/MaxGUI Module/Delta timing with MaxGUI

QuickSilva(Posted 2009) [#1]
I have my game running perfectly fine in full screen mode with delta timing but I also want to make a windowed mode option available.

Please could someone give me some advice on how to implement delta timing when using a windowed display (MaxGUI). Ideally, I want to create a display that mimics the full screen one so that I can set flip to false and let the frames per second fly. Should I be using a timer and the waitevent system?

Any help would be greatly appreciated.

Jason.


Arowx(Posted 2009) [#2]
You don't need to use MaxGUI to use windowed mode it's just a matter of using the correct parameters when setting up the graphics...
Graphics 800, 600

While Not KeyHit(KEY_SPACE) And Not AppTerminate()
	Cls
	DrawText "Windowed",10,10
	Flip
Wend

EndGraphics

Graphics 800, 600, 32

While Not KeyHit(KEY_SPACE) And Not AppTerminate()
	Cls
	DrawText "FullScreen",10,10
	Flip
Wend

EndGraphics
Omitting the depth parameter or I belive setting it to zero triggers windows mode!


plash(Posted 2009) [#3]
Correct, sending a depth of zero will get you windowed mode.


QuickSilva(Posted 2009) [#4]
Sorry, I should have said that I`m using MaxGui so that I can center my window. If there is a change I can make to a module to allow me to center the defualt BMax window then it would save me a lot of headaches (a fix that works with the latest SVN version of BMax).

I would still like to know however how I would tackle this problem with MaxGui windows.

Thanks for any further help.

Jason.


Arowx(Posted 2009) [#5]
a quick search found this


Unfortunatly it is still not a feature available by default!


Arowx(Posted 2009) [#6]
Just had a look and if you Use the PollEvent() method as oppose to the WaitEvent() method there should be no problem using a delta based update system for your logic.

The only issue is the default paint events for your canvas, but have a look at the RedrawGadget example for a way of triggering redraw events!

I believe this combined with Delta timing should work!


QuickSilva(Posted 2009) [#7]
Thanks for the help, one last question.

When using full screen mode you can set flip to false to see your real FPS. Can this be done with MaxGUI windows also?

Jason.


Arowx(Posted 2009) [#8]
Not sure on this one I think your at the mercy of the operating system for refresh when your using MaxGUI.

When your setting flip to false I think you are just not waiting for the vsync, therefore your game/app should run at it's maximum speed!