Search code examples
wpfxnaembedding

Embedding XNA in WPF: how to update gametime?


I'm trying to embedd an XNA game into my WPF application. I'm following the code shown here: http://remember.waralan.fr/?p=497 (not in english)

My problem is, gameTime is never updated, and is always 0. How can I increase as it would be in a normal XNA game?


Solution

  • I haven't found any way to update gameTime by itself, so I updated it manually using C# stopwatch.

    Thanks to Shawn Hargreaves for his article: http://blogs.msdn.com/b/shawnhar/archive/2010/12/06/when-winforms-met-game-loop.aspx