public static void Update(float deltaTime) { FileMarshal.Update(deltaTime); foreach (var pair in contentManagers) { pair.Value.Update(deltaTime); } }
/// <summary> /// Initializes the engine. /// </summary> protected sealed override void Initialize() { FileMarshal.Setup(); Content.RootDirectory = "Data"; LoadEngineContent(); LoadAssets(); IsMouseVisible = true; GraphicsDeviceManager.SynchronizeWithVerticalRetrace = false; IsFixedTimeStep = Screen.IsFullHeadless; TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 60); InactiveSleepTime = IsEditor ? TimeSpan.FromSeconds(1.0f / 2000) : TimeSpan.FromSeconds(1.0f / 60); // Alt-tabbed update rate. // If the engine ISN'T initialized (i.e, in editor mode)... if (!isInitialized) { ThreadPool.SetMinThreads(Environment.ProcessorCount, 8); Config.Initialize(); InputManager.Initialize(this); Reflection.Initialize(); ModLoader.Initialize(); GameLoop = new GameLoop(); ParticleEngine.AllocationMode = Config.Performance.UseArrayPoolParticles ? ParticleAllocationMode.ArrayPool : ParticleAllocationMode.Array; ParticleEngine.Initialize(); UIManager.Initialize(); if (!Screen.IsFullHeadless) { Core.Lighting.Initialize(); } SpatialPartitionManager.Initialize(192, 192 * 8); Core.Physics.Initialize(); Network.OnLogInfo += (msg, important) => Console.LogInfo(msg, important, LogSource.Network); Network.OnLogWarning += (msg, exception) => { if (!string.IsNullOrEmpty(msg)) { Console.LogWarning(msg, LogSource.Network); } else { Console.LogWarning(exception, LogSource.Network); } }; Network.OnLogError += (msg, exception) => { if (!string.IsNullOrEmpty(msg)) { Console.LogError(msg, LogSource.Network); } else { Console.LogError(exception, LogSource.Network); } }; SetCurrentScene("_MAIN\\empty"); if (!Screen.IsFullHeadless) { Core.Rendering.Initialize(GraphicsDeviceManager, GraphicsDevice); Console.InitializeStats(Core.Rendering.SpriteBatch); } // After core initialization. Console will work here. Console.Initialize(); Console.LogInfo("Core engine loaded.", true); Console.LogInfo("Game loop loaded:", true); Console.LogInfo(GameLoop.ToString()); Network.Initialize(); Screen.Reset(); Initalized?.Invoke(); Console.LogInfo("Finished initialization.", true); } if (IsEditor) { Editor.ChangeInstance(this); Editor.OnInitialize(this); } OnInitialize(); isInitialized = true; }