Beispiel #1
0
        protected override void Initialize()
        {
            base.Initialize();

            //now we probably are capable of detecting the gpu/cpu/etc so we confirm rendering settings
            if (AutoLoadDefaultSettings)
            {
                ConfirmRenderingSettings();
            }

            // ---------------------------------------------------------
            // Add common GameSystems - Adding order is important
            // (Unless overriden by gameSystem.UpdateOrder)
            // ---------------------------------------------------------

            // Add the input manager
            Input = InputManagerFactory.NewInputManager(Services, Context);
            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 Audio System
            GameSystems.Add(Audio);

            // Add the Font system
            GameSystems.Add(gameFontSystem);

            //Add the sprite animation System
            GameSystems.Add(SpriteAnimation);

            GameSystems.Add(ProfilerSystem);

            EffectSystem = new EffectSystem(Services);

            // If requested in game settings, compile effects remotely and/or notify new shader requests
            if (Settings != null)
            {
                EffectSystem.Compiler = EffectSystem.CreateEffectCompiler(EffectSystem, Settings.PackageId, Settings.EffectCompilation, Settings.RecordUsedEffects);
            }

            GameSystems.Add(EffectSystem);

            GameSystems.Add(SceneSystem);

            // TODO: data-driven?
            Content.Serializer.RegisterSerializer(new ImageSerializer());
            Content.Serializer.RegisterSerializer(new SoundEffectSerializer(Audio.AudioEngine));
            Content.Serializer.RegisterSerializer(new SoundMusicSerializer(Audio.AudioEngine));

            // enable multi-touch by default
            Input.MultiTouchEnabled = true;

            OnGameStarted(this);
        }
Beispiel #2
0
        public Chess()
        {
            Content.RootDirectory = "Content";

            new GraphicsDeviceManager(this);

            m_inputManager = InputManagerFactory.GetInputManager(this);
            Components.Add(m_inputManager);

            m_audioManager = AudioManagerFactory.GetAudioManager(this);
            Components.Add(m_audioManager);

            m_resourceManager = ResourceManagerFactory.GetResourceManager(this);
            Components.Add(m_resourceManager);

            m_graphicsManager = GraphicsManagerFactory.GetGraphicsManager(this);
            Components.Add(m_graphicsManager);

            m_gameStateManager = GameStateManagerFactory.GetGameStateManager(this);
            Components.Add(m_gameStateManager);
        }