public MyMinerGame(ServiceContainer services) { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyMinerGame()::constructor"); MyMwcLog.WriteLine("MyMinerGame.Constructor() - START"); MyMwcLog.IncreaseIndent(); Services = services; // we want check objectbuilders, prefab's configurations, gameplay constants and building specifications MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("Checks"); MyMwcObjectBuilder_Base.Check(); MyPrefabConstants.Check(); MyGameplayConstants.Check(); MyBuildingSpecifications.Check(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("Preallocate"); Preallocate(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("IsAdmin"); WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent(); WindowsPrincipal windowsPrincipal = new WindowsPrincipal(windowsIdentity); bool IsAdmin = windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator); MyMwcLog.WriteLine("IsAdmin " + IsAdmin.ToString()); MyMwcLog.WriteLine("Game dir: " + GameDir); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyCustomGraphicsDeviceManagerDX"); #if !DEBUG try { #endif this.Exiting += MyMinerGame_Exiting; this.Activated += MyMinerGame_OnActivated; this.Deactivated += MyMinerGame_OnDeactivated; this.m_InvokeQueue = new ConcurrentQueue <Tuple <ManualResetEvent, Action> >(); this.m_MainThread = Thread.CurrentThread; GraphicsDeviceManager = new MyCustomGraphicsDeviceManagerDX(this); m_isGraphicsSupported = GraphicsDeviceManager.ChangeProfileSupport(); m_isGraphicsSupported = true; if (m_isGraphicsSupported) { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyVideoModeManager.HookEventHandlers"); MyVideoModeManager.HookEventHandlers(); //Content = new MyCustomContentManager(Services, ContentDir); // Content = new SharpDX.Toolkit.Content.ContentManager(Services); RootDirectory = Path.Combine(GameDir, "Content"); RootDirectoryDebug = Path.GetFullPath(System.IO.Path.Combine(GameDir, "..\\..\\..\\Content")); RootDirectoryEffects = RootDirectory; Static = this; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("InitNumberOfCores"); InitNumberOfCores(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyVideoModeManager.LogApplicationInformation"); MyVideoModeManager.LogApplicationInformation(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyVideoModeManager.LogInformation"); MyVideoModeManager.LogInformation(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyVideoModeManager.LogEnvironmentInformation"); MyVideoModeManager.LogEnvironmentInformation(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyPlugins.LoadContent"); MyPlugins.LoadContent(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyConfig.Load"); MyConfig.Load(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyMath.Init"); MyMath.Init(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyTextsWrapper.Init"); MyTextsWrapper.Init(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyDialoguesWrapper.Init"); MyDialoguesWrapper.Init(); // If I don't set TargetElapsedTime, default value will be used, which is 60 times per second, and it will be more precise than if I calculate // it like below - SO I MUST BE DOING THE WRONG CALCULATION !!! // We use fixed timestep. Update() is called at this precise timesteps. If Update or Draw takes more time, Update will be called more time. Draw is called only after Update. #if RENDER_PROFILING || GPU_PROFILING IsFixedTimeStep = false; MyMinerGame.GraphicsDeviceManager.SynchronizeWithVerticalRetrace = false; #else IsFixedTimeStep = MyFakes.FIXED_TIMESTEP; #endif } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("InitMultithreading"); InitMultithreading(); #if !DEBUG } catch (Exception ex) { // We are catching exceptions in constructor, because if error occures here, it app will start unloading // so we skip to UnloadContent and there we will get another exception (because app wasn't really loaded when unload started) // So we want original exception in log. MyMwcLog.WriteLine(ex); throw; } #endif MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyMinerGame.Constructor() - END"); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); }