private void HandleFullscreenSwitch() { if (!switchingScreenMode && ImprovedKeyboard.Pressed(Keys.LeftAlt) && ImprovedKeyboard.Pressed(Keys.Enter)) { switchingScreenMode = true; if (Window.IsBorderlessEXT) { Window.IsBorderlessEXT = false; graphics.PreferredBackBufferWidth = previousResolution.X; graphics.PreferredBackBufferHeight = previousResolution.Y; } else { previousResolution = new Point(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); Window.IsBorderlessEXT = true; graphics.PreferredBackBufferWidth = GraphicsDevice.Adapter.CurrentDisplayMode.Width; graphics.PreferredBackBufferHeight = GraphicsDevice.Adapter.CurrentDisplayMode.Height; } graphics.ApplyChanges(); } if (switchingScreenMode && ImprovedKeyboard.Released(Keys.LeftAlt) && ImprovedKeyboard.Released(Keys.Enter)) { switchingScreenMode = false; } }
protected override void Update(GameTime gameTime) { ImprovedKeyboard.Update(); ImprovedMouse.Update(); currentScene.Update(gameTime); HandleFullscreenSwitch(); if (ImprovedKeyboard.DidJustPress(Keys.Q)) { Exit(); } if (currentScene is InfoScreen splash && splash.Continue) { if (isOnSplash) { currentScene = new InfoScreen(GraphicsDevice, camera, "infoscreen"); } else { currentScene = new GameScene(GraphicsDevice, camera); } isOnSplash = false; } base.Update(gameTime); }
public override void Update(GameTime gameTime) { if (GameState.GameOver) { return; } base.Update(gameTime); if (ImprovedKeyboard.DidJustPress(Keys.A)) { FinishAllActions(); } if (ImprovedKeyboard.DidJustPress(Keys.N)) { NextDifficulty(); } //if (!hasSetupStart) // return; //activeContracts.RemoveAll(x => !x.IsInteractable); //activeHosts.RemoveAll(x => !x.IsInteractable); var playtime = (float)gameTime.TotalGameTime.TotalSeconds; if (playtime > currentLevel.levelTime) { NextDifficulty(); } //if (activeContracts.Count < currentLevel.NumberOfContracts && contractTimer.Finished) //{ // AddContract(); //} //var contractProcessingNeeded = activeContracts.Sum(x => x.ProcessingLeft * GameState.BrainProcessing); //var hostProcessingAvailable = activeHosts.Sum(x => x.VisitingTimeLeft * GameState.BrainProcessing); //if (contractProcessingNeeded > hostProcessingAvailable && hostVisitTimer.Finished) //{ // AddHost(); //} }