From 4a432019f931fee76dde88f56aad8a5a1d1ba918 Mon Sep 17 00:00:00 2001 From: Christopher Whitley <103014489+AristurtleDev@users.noreply.github.com> Date: Fri, 25 Jul 2025 13:55:52 -0400 Subject: [PATCH] Remove exiting from Game1 class and make ExitOnEscape true by default in the core class --- .../src/11-Input-Management/DungeonSlime/Game1.cs | 3 --- .../src/11-Input-Management/MonoGameLibrary/Core.cs | 3 +++ .../src/12-Collision-Detection/DungeonSlime/Game1.cs | 3 --- .../src/12-Collision-Detection/MonoGameLibrary/Core.cs | 3 +++ .../learn-monogame-2d/src/13-Tilemap/DungeonSlime/Game1.cs | 3 --- .../learn-monogame-2d/src/13-Tilemap/MonoGameLibrary/Core.cs | 3 +++ .../src/14-SoundEffects-And-Music/DungeonSlime/Game1.cs | 3 --- .../src/14-SoundEffects-And-Music/MonoGameLibrary/Core.cs | 3 +++ .../src/15-Audio-Controller/DungeonSlime/Game1.cs | 3 --- .../src/15-Audio-Controller/MonoGameLibrary/Core.cs | 3 +++ .../src/16-Working-With-SpriteFonts/DungeonSlime/Game1.cs | 3 --- .../src/16-Working-With-SpriteFonts/MonoGameLibrary/Core.cs | 3 +++ .../learn-monogame-2d/src/17-Scenes/MonoGameLibrary/Core.cs | 3 +++ .../src/18-Texture-Wrapping/MonoGameLibrary/Core.cs | 3 +++ .../src/19-User-Interface-Fundamentals/MonoGameLibrary/Core.cs | 3 +++ .../src/20-Implementing-UI-With-Gum/MonoGameLibrary/Core.cs | 3 +++ .../src/21-Customizing-Gum-UI/MonoGameLibrary/Core.cs | 3 +++ .../src/22-Snake-Game-Mechanics/MonoGameLibrary/Core.cs | 3 +++ .../src/23-Completing-The-Game/MonoGameLibrary/Core.cs | 3 +++ .../learn-monogame-2d/src/24-Shaders/MonoGameLibrary/Core.cs | 3 +++ .../src/25-Packaging-Game/MonoGameLibrary/Core.cs | 3 +++ .../src/26-Publish-To-Itch/MonoGameLibrary/Core.cs | 3 +++ .../src/27-Conclusion/MonoGameLibrary/Core.cs | 3 +++ 23 files changed, 51 insertions(+), 18 deletions(-) diff --git a/Tutorials/learn-monogame-2d/src/11-Input-Management/DungeonSlime/Game1.cs b/Tutorials/learn-monogame-2d/src/11-Input-Management/DungeonSlime/Game1.cs index 613cd94..a9e3bfb 100644 --- a/Tutorials/learn-monogame-2d/src/11-Input-Management/DungeonSlime/Game1.cs +++ b/Tutorials/learn-monogame-2d/src/11-Input-Management/DungeonSlime/Game1.cs @@ -50,9 +50,6 @@ protected override void LoadContent() protected override void Update(GameTime gameTime) { - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) - Exit(); - // Update the slime animated sprite. _slime.Update(gameTime); diff --git a/Tutorials/learn-monogame-2d/src/11-Input-Management/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/11-Input-Management/MonoGameLibrary/Core.cs index 114df24..bf6d551 100644 --- a/Tutorials/learn-monogame-2d/src/11-Input-Management/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/11-Input-Management/MonoGameLibrary/Core.cs @@ -87,6 +87,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/12-Collision-Detection/DungeonSlime/Game1.cs b/Tutorials/learn-monogame-2d/src/12-Collision-Detection/DungeonSlime/Game1.cs index 77a0029..360aafe 100644 --- a/Tutorials/learn-monogame-2d/src/12-Collision-Detection/DungeonSlime/Game1.cs +++ b/Tutorials/learn-monogame-2d/src/12-Collision-Detection/DungeonSlime/Game1.cs @@ -61,9 +61,6 @@ protected override void LoadContent() protected override void Update(GameTime gameTime) { - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) - Exit(); - // Update the slime animated sprite. _slime.Update(gameTime); diff --git a/Tutorials/learn-monogame-2d/src/12-Collision-Detection/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/12-Collision-Detection/MonoGameLibrary/Core.cs index 114df24..d33570a 100644 --- a/Tutorials/learn-monogame-2d/src/12-Collision-Detection/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/12-Collision-Detection/MonoGameLibrary/Core.cs @@ -87,6 +87,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/13-Tilemap/DungeonSlime/Game1.cs b/Tutorials/learn-monogame-2d/src/13-Tilemap/DungeonSlime/Game1.cs index c4051eb..364e3a2 100644 --- a/Tutorials/learn-monogame-2d/src/13-Tilemap/DungeonSlime/Game1.cs +++ b/Tutorials/learn-monogame-2d/src/13-Tilemap/DungeonSlime/Game1.cs @@ -84,9 +84,6 @@ protected override void LoadContent() protected override void Update(GameTime gameTime) { - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) - Exit(); - // Update the slime animated sprite. _slime.Update(gameTime); diff --git a/Tutorials/learn-monogame-2d/src/13-Tilemap/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/13-Tilemap/MonoGameLibrary/Core.cs index 114df24..d33570a 100644 --- a/Tutorials/learn-monogame-2d/src/13-Tilemap/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/13-Tilemap/MonoGameLibrary/Core.cs @@ -87,6 +87,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/DungeonSlime/Game1.cs b/Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/DungeonSlime/Game1.cs index 06981c2..53fb876 100644 --- a/Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/DungeonSlime/Game1.cs +++ b/Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/DungeonSlime/Game1.cs @@ -113,9 +113,6 @@ protected override void LoadContent() protected override void Update(GameTime gameTime) { - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) - Exit(); - // Update the slime animated sprite. _slime.Update(gameTime); diff --git a/Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/MonoGameLibrary/Core.cs index 114df24..d33570a 100644 --- a/Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/MonoGameLibrary/Core.cs @@ -87,6 +87,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/15-Audio-Controller/DungeonSlime/Game1.cs b/Tutorials/learn-monogame-2d/src/15-Audio-Controller/DungeonSlime/Game1.cs index bc68826..39c0917 100644 --- a/Tutorials/learn-monogame-2d/src/15-Audio-Controller/DungeonSlime/Game1.cs +++ b/Tutorials/learn-monogame-2d/src/15-Audio-Controller/DungeonSlime/Game1.cs @@ -107,9 +107,6 @@ protected override void LoadContent() protected override void Update(GameTime gameTime) { - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) - Exit(); - // Update the slime animated sprite. _slime.Update(gameTime); diff --git a/Tutorials/learn-monogame-2d/src/15-Audio-Controller/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/15-Audio-Controller/MonoGameLibrary/Core.cs index 397c613..5be33b6 100644 --- a/Tutorials/learn-monogame-2d/src/15-Audio-Controller/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/15-Audio-Controller/MonoGameLibrary/Core.cs @@ -93,6 +93,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/16-Working-With-SpriteFonts/DungeonSlime/Game1.cs b/Tutorials/learn-monogame-2d/src/16-Working-With-SpriteFonts/DungeonSlime/Game1.cs index 2ade5c5..287f8de 100644 --- a/Tutorials/learn-monogame-2d/src/16-Working-With-SpriteFonts/DungeonSlime/Game1.cs +++ b/Tutorials/learn-monogame-2d/src/16-Working-With-SpriteFonts/DungeonSlime/Game1.cs @@ -131,9 +131,6 @@ protected override void LoadContent() protected override void Update(GameTime gameTime) { - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) - Exit(); - // Update the slime animated sprite. _slime.Update(gameTime); diff --git a/Tutorials/learn-monogame-2d/src/16-Working-With-SpriteFonts/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/16-Working-With-SpriteFonts/MonoGameLibrary/Core.cs index 397c613..5be33b6 100644 --- a/Tutorials/learn-monogame-2d/src/16-Working-With-SpriteFonts/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/16-Working-With-SpriteFonts/MonoGameLibrary/Core.cs @@ -93,6 +93,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/17-Scenes/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/17-Scenes/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/17-Scenes/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/17-Scenes/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/18-Texture-Wrapping/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/18-Texture-Wrapping/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/18-Texture-Wrapping/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/18-Texture-Wrapping/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/19-User-Interface-Fundamentals/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/19-User-Interface-Fundamentals/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/19-User-Interface-Fundamentals/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/19-User-Interface-Fundamentals/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/20-Implementing-UI-With-Gum/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/20-Implementing-UI-With-Gum/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/20-Implementing-UI-With-Gum/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/20-Implementing-UI-With-Gum/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/21-Customizing-Gum-UI/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/21-Customizing-Gum-UI/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/21-Customizing-Gum-UI/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/21-Customizing-Gum-UI/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/22-Snake-Game-Mechanics/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/22-Snake-Game-Mechanics/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/22-Snake-Game-Mechanics/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/22-Snake-Game-Mechanics/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/23-Completing-The-Game/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/23-Completing-The-Game/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/23-Completing-The-Game/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/23-Completing-The-Game/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/24-Shaders/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/24-Shaders/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/24-Shaders/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/24-Shaders/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/25-Packaging-Game/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/25-Packaging-Game/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/25-Packaging-Game/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/25-Packaging-Game/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/26-Publish-To-Itch/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/26-Publish-To-Itch/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/26-Publish-To-Itch/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/26-Publish-To-Itch/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize() diff --git a/Tutorials/learn-monogame-2d/src/27-Conclusion/MonoGameLibrary/Core.cs b/Tutorials/learn-monogame-2d/src/27-Conclusion/MonoGameLibrary/Core.cs index d83c54f..40aaa84 100644 --- a/Tutorials/learn-monogame-2d/src/27-Conclusion/MonoGameLibrary/Core.cs +++ b/Tutorials/learn-monogame-2d/src/27-Conclusion/MonoGameLibrary/Core.cs @@ -100,6 +100,9 @@ public Core(string title, int width, int height, bool fullScreen) // Mouse is visible by default IsMouseVisible = true; + + // Exit on escape is true by default + ExitOnEscape = true; } protected override void Initialize()