The FPS property is not assignable…
how can I control the framerate. Is it just waiting for VerticalBlank and dependent to my screen refresh rate?
I don’t really get the whole event loop of the AppInstannce/Window classes. Is there a link with a full explanation (more than the summary of the docs)?
I remember I read some things about fixed framerate and other things like that. I’ve also seen examples with the OnUpdate method in MX2 but can’t find it in the docs. What has really changed and how?
Is even there some eventloop if ‘App.RequestRender’ is not called?
<pre class=”lang:monkey decode:true ” title=”Framerate”>#Import “<std>”
Class MyWindow Extends Window
timer = New Timer(10,OnUpdate)
If Keyboard.KeyReleased(Key.Escape) Then instance.Terminate()
Method OnRender( canvas:Canvas ) Override
instance = New AppInstance
This I used to change the framerate. Using a timer.
The code insertion seems not to work? No idea what is happening.
Sorry about that – more wordpress weirdness, should be fixed now.
Ok so OnUpdate (not documented yet) is a must in some situations…? May be I should wait for more complete docs before trying to understand the whole appInstance/window process.
No you don’t need to separate out your update (you can certainly as the above example shows). Put everything into the OnRender as follows:
Method OnRender(canvas:Canvas) Override
'other things you wish to update
'other things you wish to render
This way the system handles everything – most of the available samples follow this example. You can create the OnUpdate timer if you want to update more regularly or at a specific rate.
That did catch me out initially trying to work through what was what.
You must be logged in to reply to this topic.
Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research.