public void SetDeviceViewport(Viewport viewport) { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyMinerGame::SetDeviceViewport"); if (m_renderTargetsCount == 0) { if ((MyMinerGame.Static.GraphicsManager.PreferredBackBufferHeight >= (viewport.Height + viewport.Y)) && (MyMinerGame.Static.GraphicsManager.PreferredBackBufferWidth >= (viewport.Width + viewport.X))) { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("set viewport"); MyMinerGame.Static.GraphicsDevice.Viewport = viewport; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); } else { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("change screen size"); MyVideoModeManager.UpdateScreenSize(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); } } else { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("set viewport"); MyMinerGame.Static.GraphicsDevice.Viewport = viewport; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); }
/// <summary> /// Load graphics resources content. /// </summary> public override void LoadContent() { int block1 = -1; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyMinerGame::LoadContent", ref block1); base.LoadContent(); DefaultSurface = MyMinerGame.Static.GraphicsDevice.GetRenderTarget(0); DefaultSurface.DebugName = "DefaultSurface"; DefaultDepth = MyMinerGame.Static.GraphicsDevice.DepthStencilSurface; DefaultDepth.DebugName = "DefaultDepth"; MyMwcLog.WriteLine("MyMinerGame.LoadContent() - START"); MyMwcLog.IncreaseIndent(); MyVideoModeManager.UpdateScreenSize(); System.Drawing.Font systemfont = new System.Drawing.Font("Tahoma", 12f, FontStyle.Regular); m_debugFont = new SharpDX.Direct3D9.Font(GraphicsDevice, systemfont); // GUI MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyGuiManager.LoadContent()"); MyGuiManager.LoadContent(); // Models MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyModels.LoadContent()"); MyModels.LoadContent(); // Render MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyRender.LoadContent();"); MyRender.LoadContent(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyDebugDraw.LoadContent();"); MyDebugDraw.LoadContent(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyDebugDrawCachedLines.LoadContent()"); MyDebugDrawCachedLines.LoadContent(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MySunGlare.LoadContent()"); MySunGlare.LoadContent(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyMinerGame.LoadContent() - END"); GC.Collect(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(block1); }