Skip to content

Commit d8db4b1

Browse files
committed
Use WasKeyJustPressed for ExitOnEscape
1 parent 8f1fe72 commit d8db4b1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

  • articles/tutorials/building_2d_games
    • 11_input_management/snippets
    • 15_audio_controller/snippets

articles/tutorials/building_2d_games/11_input_management/snippets/core.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected override void Update(GameTime gameTime)
112112
// Update the input manager.
113113
Input.Update(gameTime);
114114

115-
if (ExitOnEscape && Input.Keyboard.IsKeyDown(Keys.Escape))
115+
if (ExitOnEscape && Input.Keyboard.WasKeyJustPressed(Keys.Escape))
116116
{
117117
Exit();
118118
}

articles/tutorials/building_2d_games/15_audio_controller/snippets/core.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected override void Update(GameTime gameTime)
132132
// Update the audio controller.
133133
Audio.Update();
134134

135-
if (ExitOnEscape && Input.Keyboard.IsKeyDown(Keys.Escape))
135+
if (ExitOnEscape && Input.Keyboard.WasKeyJustPressed(Keys.Escape))
136136
{
137137
Exit();
138138
}

0 commit comments

Comments
 (0)