protected override void OnRenderFrame(FrameEventArgs e) { SleepTime = Math.Max(0.0, SleepTime - e.Time); if (SleepTime == 0.0) { GameCreatorDraw?.Invoke(this, EventArgs.Empty); SwapBuffers(); } }
protected override void Draw(GameTime gameTime) { if (gameTime.ElapsedGameTime.TotalSeconds > 0.0) { Fps = 1.0 / gameTime.ElapsedGameTime.TotalSeconds; } else { Fps = 0.0; } SleepTime = Math.Max(0.0, SleepTime - gameTime.ElapsedGameTime.TotalSeconds); if (SleepTime == 0.0) { GameCreatorDraw?.Invoke(this, EventArgs.Empty); } base.Draw(gameTime); }