/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> public Game() { // Register the logger backend before anything else logListener = GetLogListener(); if (logListener != null) GlobalLogger.GlobalMessageLogged += logListener; // Create and register all core services Input = new InputManager(Services); Script = new ScriptSystem(Services); SceneSystem = new SceneSystem(Services); Audio = new AudioSystem(Services); UI = new UISystem(Services); gameFontSystem = new GameFontSystem(Services); SpriteAnimation = new SpriteAnimationSystem(Services); ProfilerSystem = new GameProfilingSystem(Services); // --------------------------------------------------------- // Add common GameSystems - Adding order is important // (Unless overriden by gameSystem.UpdateOrder) // --------------------------------------------------------- // Add the input manager GameSystems.Add(Input); // Add the scheduler system // - Must be after Input, so that scripts are able to get latest input // - Must be before Entities/Camera/Audio/UI, so that scripts can apply // changes in the same frame they will be applied GameSystems.Add(Script); // Add the UI System GameSystems.Add(UI); // Add the Audio System GameSystems.Add(Audio); // Add the Font system GameSystems.Add(gameFontSystem); //Add the sprite animation System GameSystems.Add(SpriteAnimation); Asset.Serializer.LowLevelSerializerSelector = ParameterContainerExtensions.DefaultSceneSerializerSelector; // Creates the graphics device manager GraphicsDeviceManager = new GraphicsDeviceManager(this); GameSystems.Add(ProfilerSystem); AutoLoadDefaultSettings = true; }
/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> public Game() { // Register the logger backend before anything else logListener = GetLogListener(); if (logListener != null) GlobalLogger.GlobalMessageLogged += logListener; // Create all core services, except Input which is created during `Initialize'. // Registration takes place in `Initialize'. Script = new ScriptSystem(Services); SceneSystem = new SceneSystem(Services); Audio = new AudioSystem(Services); gameFontSystem = new GameFontSystem(Services); SpriteAnimation = new SpriteAnimationSystem(Services); ProfilerSystem = new GameProfilingSystem(Services); Content.Serializer.LowLevelSerializerSelector = ParameterContainerExtensions.DefaultSceneSerializerSelector; // Creates the graphics device manager GraphicsDeviceManager = new GraphicsDeviceManager(this); AutoLoadDefaultSettings = true; }
protected internal override void OnSystemAdd() { base.OnSystemAdd(); audioSystem = Services.GetServiceAs <AudioSystem>(); }