/// <summary> /// Called by the GameManager on the startup of the application to initiate the modal game loop. /// Do not call this. /// </summary> public void RunLoop() { mMainThread = System.Threading.Thread.CurrentThread; if (isRunning == true) { throw new Exception("VideoThread.RunLoop was already called! You cannot run the main loop twice!"); } isRunning = true; GraphicsManager.CreateDevice(true, true); UI.FontManager.init(); PushOverlay(new UI.TerrainInfoOverlay()); PushOverlay(new UI.Overlays.ChunkInfoOverlay()); Game.GameManager.ActiveChangeModeChanged += () => { switch (Game.GameManager.ActiveChangeType) { case Logic.ActiveChangeType.Height: if (GetOverlay <UI.TerrainInfoOverlay>() == null) { PushOverlay(new UI.TerrainInfoOverlay()); } if (GetOverlay <UI.TextureInfoOverlay>() != null) { RemoveOverlay <UI.TextureInfoOverlay>(); } break; case Logic.ActiveChangeType.Texturing: if (GetOverlay <UI.TextureInfoOverlay>() == null) { PushOverlay(new UI.TextureInfoOverlay()); } if (GetOverlay <UI.TerrainInfoOverlay>() != null) { RemoveOverlay <UI.TerrainInfoOverlay>(); } break; } }; MessagePump.Run(mWindow, FrameLoop); }