|
|
@ -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.
|
|
|
|