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(); }
protected override void Draw(GameTime time) { StackEngine.Draw(); if (EngineVariables.ShowFPS) { Counter.Draw(StackEngine.Renderer.SpriteBatch, StackEngine.Renderer.DefaultFont, Vector2.Zero); } }
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); } }
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); }
public void Start(StackEngine engine) { Engine = engine; OnStart(); }
protected override void UnloadContent() { StackEngine.Dispose(); }