public void Update() { long currentTime = Root.Timer.Milliseconds; TimeStep = (currentTime - LastTime) / 1000.0f; LastTime = currentTime; TimeAccumulator += TimeStep; TimeAccumulator = System.Math.Min(TimeAccumulator, FixedTimeStep * (FixedFPS / 15)); Keyboard.Capture(); Mouse.Capture(); Root.RenderOneFrame(); Labeler.Update(); User.Update(); while (TimeAccumulator >= FixedTimeStep) { TypedInput.Update(); for (int i = 0; i < 4; i++) { NewtonWorld.Update(FixedTimeStep / 4.0f); } HumanController.Update(); ObjectManager.Update(); TimeAccumulator -= FixedTimeStep; //// mjuzik status i ogarnięcie żeby przełączało na następną piosenkę z plejlisty po zakończeniu poprzedniej } WindowEventUtilities.MessagePump(); }
public override bool MessagePump() { var rt = ((Viewport)_renderManager.MainViewport.Native).Target as RenderWindow; // check if primary window has been closed if (rt == null || rt.IsClosed) { return(false); } WindowEventUtilities.MessagePump(); Root.Singleton.RenderOneFrame(); return(true); }
/************************************************************************/ /* update ogre manager, also processes the systems event queue */ /************************************************************************/ internal void Update() { // check if ogre manager is initialized if (mRoot == null) { return; } // process windows event queue (only if no external window is used) WindowEventUtilities.MessagePump(); // render next frame if (mRenderingActive) { mRoot.RenderOneFrame(); } }
public void start(AppState state) { changeAppState(state); uint timeSinceLastFrame = 1; uint startTime = 0; if (OnAppStateManagerStarted != null) { OnAppStateManagerStarted(); } while (!isShutdown) { if (EngineManager.Instance.renderWindow.IsClosed) { isShutdown = true; break; } WindowEventUtilities.MessagePump(); if (EngineManager.Instance.renderWindow.IsActive) { startTime = EngineManager.Instance.timer.MillisecondsCPU; activeStateStack.Last().update(timeSinceLastFrame * 1.0 / 1000); EngineManager.Instance.keyboard.Capture(); EngineManager.Instance.mouse.Capture(); EngineManager.Instance.Update((float)(timeSinceLastFrame * 1.0 / 1000)); EngineManager.Instance.root.RenderOneFrame(); timeSinceLastFrame = EngineManager.Instance.timer.MillisecondsCPU - startTime; } else { System.Threading.Thread.Sleep(1000); } } //Save locate Info to file before exiting the main game loop EngineManager.Instance.Exit(); }
public void start(AppState state) { changeAppState(state); int timeSinceLastFrame = 1; int startTime = 0; while (!m_bShutdown) { if (AdvancedMogreFramework.Singleton.m_pRenderWnd.IsClosed) { m_bShutdown = true; } WindowEventUtilities.MessagePump(); if (AdvancedMogreFramework.Singleton.m_pRenderWnd.IsActive) { startTime = (int)AdvancedMogreFramework.Singleton.m_pTimer.MicrosecondsCPU; AdvancedMogreFramework.Singleton.m_pKeyboard.Capture(); AdvancedMogreFramework.Singleton.m_pMouse.Capture(); m_ActiveStateStack.Last().update(timeSinceLastFrame); AdvancedMogreFramework.Singleton.m_pKeyboard.Capture(); AdvancedMogreFramework.Singleton.m_pMouse.Capture(); AdvancedMogreFramework.Singleton.updateOgre(timeSinceLastFrame); if (AdvancedMogreFramework.Singleton.m_pRoot != null) { AdvancedMogreFramework.Singleton.m_pRoot.RenderOneFrame(); } timeSinceLastFrame = (int)AdvancedMogreFramework.Singleton.m_pTimer.MillisecondsCPU - startTime; } else { System.Threading.Thread.Sleep(1000); } } AdvancedMogreFramework.Singleton.m_pLog.LogMessage("Main loop quit"); }
public void Update() { Mysz.height = (int)Root.AutoCreatedWindow.Height; Mysz.width = (int)Root.AutoCreatedWindow.Width; long currentTime = Root.Timer.Milliseconds; TimeStep = (currentTime - LastTime) / 1000.0f; LastTime = currentTime; TimeAccumulator += TimeStep; TimeAccumulator = System.Math.Min(TimeAccumulator, FixedTimeStep * (FixedFPS / 15)); Keyboard.Capture(); Mouse.Capture(); Root.RenderOneFrame(); Labeler.Update(); IngameConsole.Update(); SoundManager.CheckPlaylist(); while (TimeAccumulator >= FixedTimeStep) { TypedInput.Update(); if (!Pause) { for (int i = 0; i < 4; i++) { NewtonWorld.Update(FixedTimeStep / 4.0f); } ObjectManager.Update(); GameCamera.Update(); } HumanController.Update(); TimeAccumulator -= FixedTimeStep; } WindowEventUtilities.MessagePump(); if (CurrentLevel.LoadNewMap) { Engine.Singleton.IngameConsole.Print("Ladowanie mapy: " + CurrentLevel.NewMapName); HumanController.HUD.ToggleLoadScreen(); Root.RenderOneFrame(); HumanController.Character.Contact = null; CurrentLevel.DeleteLevel(); CurrentLevel.LoadLevel(CurrentLevel.NewMapName, CurrentLevel.NewMapNav, false); CurrentLevel.LoadNewMap = false; CurrentLevel.NewMapName = ""; CurrentLevel.NewMapNav = ""; if (CurrentLevel.DeleteWithAutoSave) { Load(null); } else { CurrentLevel.DeleteWithAutoSave = true; } HumanController.HUD.ToggleLoadScreen(); } }