diff --git a/Shared/Input.cs b/Shared/Input.cs
index 852368e..c15cfd3 100644
--- a/Shared/Input.cs
+++ b/Shared/Input.cs
@@ -3,13 +3,14 @@ using Microsoft.Xna.Framework.Input;
namespace SemiColinGames {
struct Input {
+ public Vector2 Motion;
public bool Jump;
public bool Attack;
- public Vector2 Motion;
+ public bool Pause;
+ public bool Debug;
public bool Exit;
public bool FullScreen;
- public bool Debug;
public Input(GamePadState gamePad, KeyboardState keyboard) {
// First we process normal buttons.
@@ -19,10 +20,16 @@ namespace SemiColinGames {
keyboard.IsKeyDown(Keys.K);
// Then special debugging sorts of buttons.
- Exit = gamePad.IsButtonDown(Buttons.Start) || keyboard.IsKeyDown(Keys.Escape);
- FullScreen = gamePad.IsButtonDown(Buttons.Back) || keyboard.IsKeyDown(Keys.F12) ||
- keyboard.IsKeyDown(Keys.OemPlus);
+ Exit = keyboard.IsKeyDown(Keys.Escape) ||
+ (gamePad.IsButtonDown(Buttons.LeftShoulder) &&
+ gamePad.IsButtonDown(Buttons.RightShoulder) &&
+ gamePad.IsButtonDown(Buttons.Start));
+ FullScreen = keyboard.IsKeyDown(Keys.F12) || keyboard.IsKeyDown(Keys.OemPlus) ||
+ (gamePad.IsButtonDown(Buttons.LeftShoulder) &&
+ gamePad.IsButtonDown(Buttons.RightShoulder) &&
+ gamePad.IsButtonDown(Buttons.Back));
Debug = gamePad.IsButtonDown(Buttons.LeftShoulder) || keyboard.IsKeyDown(Keys.OemMinus);
+ Pause = gamePad.IsButtonDown(Buttons.Start) || keyboard.IsKeyDown(Keys.Pause);
// Then potential motion directions. If the player attempts to input opposite directions at
// once (up & down or left & right), those inputs cancel out, resulting in no motion.
diff --git a/Shared/SneakGame.cs b/Shared/SneakGame.cs
index 83168a4..7608b00 100644
--- a/Shared/SneakGame.cs
+++ b/Shared/SneakGame.cs
@@ -13,6 +13,7 @@ namespace SemiColinGames {
SpriteBatch spriteBatch;
SpriteFont font;
bool fullScreen = false;
+ bool paused = false;
IDisplay display;
History input = new History(2);
@@ -71,6 +72,10 @@ namespace SemiColinGames {
Exit();
}
+ if (input[0].Pause && !input[1].Pause) {
+ paused = !paused;
+ }
+
if (input[0].FullScreen && !input[1].FullScreen) {
fullScreen = !fullScreen;
display.SetFullScreen(fullScreen);
@@ -80,10 +85,11 @@ namespace SemiColinGames {
Debug.Enabled = !Debug.Enabled;
}
- List collisionTargets = world.CollisionTargets();
- player.Update(gameTime, input, collisionTargets);
-
- camera.Update(player.Position);
+ if (!paused) {
+ List collisionTargets = world.CollisionTargets();
+ player.Update(gameTime, input, collisionTargets);
+ camera.Update(player.Position);
+ }
base.Update(gameTime);
}
@@ -95,6 +101,10 @@ namespace SemiColinGames {
fpsCounter.Update();
string fpsText = $"{GraphicsDevice.Viewport.Width}x{GraphicsDevice.Viewport.Height}, " +
$"{fpsCounter.Fps} FPS";
+ if (paused) {
+ fpsText = fpsText + " (paused)";
+ }
+
Debug.SetFpsText(fpsText);
// Draw scene to RenderTarget.