public void SetGameLoop(GameLoop gameLoop) { if (this.gameLoop != null) { this.gameLoop.Update -= GameLoopOnUpdate; } this.gameLoop = gameLoop; if (this.gameLoop != null) { this.gameLoop.Update += GameLoopOnUpdate; } }
void OnLoaded(object sender, RoutedEventArgs e) { Initialize(); //add border int borderWidth = (int)(ScreenHeight * .05f); border = new Border(ScreenWidth, ScreenHeight, borderWidth, ScreenCenter); border.Load(this, physicsSimulator); GameLoop loop = new GameLoop(); SetGameLoop(loop); loop.Start(); }