Skip to content

Instantly share code, notes, and snippets.

@samneirinck
Created December 28, 2011 20:05
Show Gist options
  • Save samneirinck/1529470 to your computer and use it in GitHub Desktop.
Save samneirinck/1529470 to your computer and use it in GitHub Desktop.
protected virtual void OnStartGame()
{
Console.WriteLine("OnStartGame");
Trace.Listeners.Add(new TextWriterTraceListener(@"c:\temp\calls.log"));
if (GameStarted != null)
{
// Crazy and terrible workaround
// Somehow doing stuff at this stage, like spawning entities, will happen to soon, and not show up ingame at all
// If we sleep a bit it should all work fine
// PLEASE FIX THIS SOME TIME
var t = new Thread(() =>
{
Thread.Sleep(1);
Dispatcher.BeginInvoke(() => GameStarted(this, new EventArgs()));
});
t.Start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment