conkerjoe's picture

GameWindow modification suggestion

Iv just recently started using OpenTK to substitue XNA in my cross platform 2D Game engine. firstly, i was amazed how easy it was to use so thanks for that.
But i would like to make a suggestion for the main game loop and the paremeter passed to the Update and Render methods on the GameWindow class. Currently in update the UpdateFrameEventArgs is passed in which contains a double Time value which is the number of seconds passed since last update. I think a nice addition would be to model the XNA time class and offer ElapsedGameTime and ElapsedRealTime values on the UpdateFrameEventArgs parameter. These would both be TimeSpan's.

I would be willing to try make this mod myself and offer the solution for commit. But before i do has anyone else already done this, or does anyone have any different suggestions, would this change get commited if i was to implement it ?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

This is interesting - indeed TimeSpans would be nicer (and more flexible).

What is the difference between ElapsedGameTime and ElapsedRealTime in XNA?

conkerjoe's picture

From the msdn docs.

ElapsedGameTime - The amount of elapsed game time since the last update
"Fixed-step clocks update by a fixed time span upon every clock step. This results in uniform clock steps that may not actually track the wall clock time. Fixed-step clocks were popular on console systems where one had tight control over code and a fixed system performance. Fixed-step clocks are also useful when trying to achieve deterministic updates for debugging, offline rendering, or other such scenarios."

ElapsedRealTime - The amount of elapsed real time (wall clock) since the last frame.
"Variable-step clocks automatically track the difference in real-time (wall clock) that transpired since the last clock step. This type of game timing is popular on PC games where the variable PC configurations affect update time."

It also has a TotalGameTime and TotalRealTime

For my project the ElapsedGameTime is the important one but its probably worth implementing the other too for the sake of completion.

Url to the msdn doc

conkerjoe's picture

by the way if you're interested in seeing what im working on, it was originally just an XNA 2d Engine, but i ported it to OpenTK too and tested fully on Mono on a linux distribution

CreamX On Codeplex
My Blog

the Fiddler's picture

Thanks for the info and the links. Your project looks very interesting!

Sounds like a good addition, I'll look into this for the next version.