wx application flow

BlitzMax Forums/Brucey's Modules/wx application flow

JoshK(Posted 2009) [#1]
I got wxWidgets working with my engine:


In Sandbox (using MaxGUI), my program loop is like this:
Repeat
	If realtime
		PauseApp()
		While PeekEvent()
			WaitEvent()
		Wend
		ResumeApp()
		world.Update()
		world.Render()
		Flip(0)
	Else
		WaitEvent()
	EndIf
Forever


How can I achieve the real-time approach with wxWidgets? I do not want to use a timer.


plash(Posted 2009) [#2]
real-time approach
What is that, exactly? All I see is a loop which decides what to do based on a variable which has no description.

In wxMax you do not handle event gathering - it does it for you - so all you need to worry about is doing the right stuff when your events are received.


JoshK(Posted 2009) [#3]
The 'realtime' variable is set to True when the application is running in realtime rendering mode.


Brucey(Posted 2009) [#4]
Have a look at the "mainloop" sample. (if you can make sense of it ;-)

It gives you more control over the event loop of wxWidgets.

Somewhere in that loop you should be able to run your own stuff too.


If you are intending on having the window resizable, you should probably connect to the wxEVT_SIZE event, and maybe call SetViewPort - just in case...


Brucey(Posted 2009) [#5]
Just one word of warning - wxWidgets doesn't like to go full-screen. There are issues forwarding events to a full-screen context.

For windowed tools and apps, it works great though.


Not that I haven't tried to solve this issue, but once I have to start working with low-level hacky OS-specific things.... well... you can imagine how much fun that is.


JoshK(Posted 2009) [#6]
Thanks.

The full-screen graphics problem is not an issue for me.


JoshK(Posted 2009) [#7]
Cool, this is fine.

wxWidgets is a little weird, but if I can just isolate the code off I will be fine.