Пример #1
0
        protected override void Initialize()
        {
            IsFixedTimeStep = true;
            IsMouseVisible  = false;

            GameSettings.Initialize(Graphics, Game.VirtualResolution);

            var Services = new GameServiceContainer();

            Services.AddService(typeof(IGraphicsDeviceService), Graphics);
            Services.AddService(typeof(ISkipContent), this);

            InputProvider = new UserInputProvider();
            StackEngine   = new StackEngine(Game, Services, InputProvider, GameSettings);

            if (GameSettings.Debug)
            {
                InputProvider.Handler += HandleDebugInputEvent;
            }

            InputProvider.Handler += HandleSkipInputEvent;

            StackEngine.OnExit += Exit;

            Counter = new FrameRateCounter();
            SetSpeed(GameSpeed.Default);

            base.Initialize();
        }
Пример #2
0
        protected override void Draw(GameTime time)
        {
            StackEngine.Draw();

            if (EngineVariables.ShowFPS)
            {
                Counter.Draw(StackEngine.Renderer.SpriteBatch, StackEngine.Renderer.DefaultFont, Vector2.Zero);
            }
        }
Пример #3
0
        public void HandleDebugInputEvent(InputEvent input)
        {
            if (input.Handled)
            {
                return;
            }

            if (input.IsKeyPress(Keys.Tab))
            {
                StackEngine.Console.Toggle();
                StackEngine.Pause(StackEngine.Console.Visible);
            }

            if (StackEngine.Console.Visible)
            {
                return;
            }

            // Switch to the next bloom settings preset?

            if (input.IsKeyPress(Keys.F11) && false)
            {
                BloomIndex = (BloomIndex + 1) % BloomSettings.PresetSettings.Length;

                StackEngine.Game.World.Get <RenderSettings>().BloomSettings = BloomSettings.PresetSettings[BloomIndex];
                StackEngine.Game.World.Get <RenderSettings>().BloomEnabled  = true;
            }

            // Toggle bloom on or off?
            if (input.IsKeyPress(Keys.F12))
            {
                StackEngine.Game.World.Get <RenderSettings>().BloomEnabled = !StackEngine.Game.World.Get <RenderSettings>().BloomEnabled;
            }

            if (input.IsKeyPress(Keys.F1))
            {
                SetSpeed(GameSpeed.Default);
            }

            if (input.IsKeyPress(Keys.F2))
            {
                SetSpeed(GameSpeed.Double);
            }

            if (input.IsKeyPress(Keys.F3))
            {
                SetSpeed(GameSpeed.Half);
            }
        }
Пример #4
0
        protected override void Update(GameTime time)
        {
            if (EngineVariables.ShowFPS)
            {
                Counter.UpdateStart();
            }

            StackEngine.Update();

            if (EngineVariables.ShowFPS)
            {
                Counter.UpdateEnd();
            }

            if (SkipCutscene.Enabled)
            {
                SuppressDraw();
            }

            base.Update(time);
        }
Пример #5
0
 public void Start(StackEngine engine)
 {
     Engine = engine;
     OnStart();
 }
Пример #6
0
 protected override void UnloadContent()
 {
     StackEngine.Dispose();
 }