/// <summary> /// Main game loop - update - draw - sleep /// </summary> private void GameLoop() { LoadGui(); LoadSolarSystem(); LoadKernels(); Dispatcher.BeginInvoke(new Action(OnFinishLoading), DispatcherPriority.Render, null); _camera = new Camera(_gravitationalBodies[_targetIndex], 0.3); //_camera = new Camera(_gravitationalBodies[_targetIndex], 5000); _timeStepIndex = TimeStep.RealTimeIndex; _timeSteps = TimeStep.Defaults(); var frameTimer = new FpsManager(60); while (_isActive) { frameTimer.StartFrame(); TimeStep timeStep = _timeSteps[_timeStepIndex]; Update(timeStep); DrawFrame(timeStep, frameTimer); WriteFrameToScreen(); frameTimer.FinishFrame(); } }
/// <summary> /// Main game loop - update - draw - sleep /// </summary> private void GameLoop() { var frameTimer = new FpsManager(60); while (_isActive) { frameTimer.StartFrame(); TimeStep timeStep = _timeSteps[_timeStepIndex]; Update(timeStep); DrawFrame(timeStep, frameTimer); WriteFrameToScreen(); frameTimer.FinishFrame(); } }