Skip to content

Commit 2a53d1d

Browse files
Merge pull request #91 from AristurtleDev/docs/142-exit-on-escape-logic
Updates To Tutorial Source From Documentation PR
2 parents ce86f31 + 4a43201 commit 2a53d1d

File tree

23 files changed

+51
-18
lines changed
  • Tutorials/learn-monogame-2d/src
    • 11-Input-Management
    • 12-Collision-Detection
    • 13-Tilemap
    • 14-SoundEffects-And-Music
    • 15-Audio-Controller
    • 16-Working-With-SpriteFonts
    • 17-Scenes/MonoGameLibrary
    • 18-Texture-Wrapping/MonoGameLibrary
    • 19-User-Interface-Fundamentals/MonoGameLibrary
    • 20-Implementing-UI-With-Gum/MonoGameLibrary
    • 21-Customizing-Gum-UI/MonoGameLibrary
    • 22-Snake-Game-Mechanics/MonoGameLibrary
    • 23-Completing-The-Game/MonoGameLibrary
    • 24-Shaders/MonoGameLibrary
    • 25-Packaging-Game/MonoGameLibrary
    • 26-Publish-To-Itch/MonoGameLibrary
    • 27-Conclusion/MonoGameLibrary

23 files changed

+51
-18
lines changed

Tutorials/learn-monogame-2d/src/11-Input-Management/DungeonSlime/Game1.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ protected override void LoadContent()
5050

5151
protected override void Update(GameTime gameTime)
5252
{
53-
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
54-
Exit();
55-
5653
// Update the slime animated sprite.
5754
_slime.Update(gameTime);
5855

Tutorials/learn-monogame-2d/src/11-Input-Management/MonoGameLibrary/Core.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public Core(string title, int width, int height, bool fullScreen)
8787

8888
// Mouse is visible by default
8989
IsMouseVisible = true;
90+
91+
// Exit on escape is true by default
92+
ExitOnEscape = true;
9093
}
9194

9295
protected override void Initialize()

Tutorials/learn-monogame-2d/src/12-Collision-Detection/DungeonSlime/Game1.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ protected override void LoadContent()
6161

6262
protected override void Update(GameTime gameTime)
6363
{
64-
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
65-
Exit();
66-
6764
// Update the slime animated sprite.
6865
_slime.Update(gameTime);
6966

Tutorials/learn-monogame-2d/src/12-Collision-Detection/MonoGameLibrary/Core.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public Core(string title, int width, int height, bool fullScreen)
8787

8888
// Mouse is visible by default
8989
IsMouseVisible = true;
90+
91+
// Exit on escape is true by default
92+
ExitOnEscape = true;
9093
}
9194

9295
protected override void Initialize()

Tutorials/learn-monogame-2d/src/13-Tilemap/DungeonSlime/Game1.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ protected override void LoadContent()
8484

8585
protected override void Update(GameTime gameTime)
8686
{
87-
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
88-
Exit();
89-
9087
// Update the slime animated sprite.
9188
_slime.Update(gameTime);
9289

Tutorials/learn-monogame-2d/src/13-Tilemap/MonoGameLibrary/Core.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public Core(string title, int width, int height, bool fullScreen)
8787

8888
// Mouse is visible by default
8989
IsMouseVisible = true;
90+
91+
// Exit on escape is true by default
92+
ExitOnEscape = true;
9093
}
9194

9295
protected override void Initialize()

Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/DungeonSlime/Game1.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ protected override void LoadContent()
113113

114114
protected override void Update(GameTime gameTime)
115115
{
116-
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
117-
Exit();
118-
119116
// Update the slime animated sprite.
120117
_slime.Update(gameTime);
121118

Tutorials/learn-monogame-2d/src/14-SoundEffects-And-Music/MonoGameLibrary/Core.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public Core(string title, int width, int height, bool fullScreen)
8787

8888
// Mouse is visible by default
8989
IsMouseVisible = true;
90+
91+
// Exit on escape is true by default
92+
ExitOnEscape = true;
9093
}
9194

9295
protected override void Initialize()

Tutorials/learn-monogame-2d/src/15-Audio-Controller/DungeonSlime/Game1.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ protected override void LoadContent()
107107

108108
protected override void Update(GameTime gameTime)
109109
{
110-
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
111-
Exit();
112-
113110
// Update the slime animated sprite.
114111
_slime.Update(gameTime);
115112

Tutorials/learn-monogame-2d/src/15-Audio-Controller/MonoGameLibrary/Core.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ public Core(string title, int width, int height, bool fullScreen)
9393

9494
// Mouse is visible by default
9595
IsMouseVisible = true;
96+
97+
// Exit on escape is true by default
98+
ExitOnEscape = true;
9699
}
97100

98101
protected override void Initialize()

0 commit comments

Comments
 (0)