From 6f1d7e6d4dfbfac3c3756a629c4585319d789ed9 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sun, 3 Jun 2012 15:42:25 -0500 Subject: [PATCH] Adding inputstate extension --- axios/Engine/Extensions/InputState.cs | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 axios/Engine/Extensions/InputState.cs diff --git a/axios/Engine/Extensions/InputState.cs b/axios/Engine/Extensions/InputState.cs new file mode 100644 index 0000000..53c0165 --- /dev/null +++ b/axios/Engine/Extensions/InputState.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GameStateManagement; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace Axios.Engine.Extensions +{ + public static class AxiosExtensions_InputState + { + // I got tired of always specifying Player one + //-- Nathan Adams [adamsna@datanethost.net] - 6/3/2012 + /// + /// This checks if the key is pressed by player one + /// + /// + /// + public static bool IsKeyPressed(this InputState input, Keys key) + { + PlayerIndex p; + return input.IsKeyPressed(key, PlayerIndex.One, out p); + } + + public static bool IsButtonPressed(this InputState input, Buttons button) + { + PlayerIndex p; + return input.IsButtonPressed(button, PlayerIndex.One, out p); + } + + public static bool IsNewKeyPress(this InputState input, Keys key) + { + PlayerIndex p; + return input.IsNewKeyPress(key, PlayerIndex.One, out p); + } + + public static bool IsNewButtonPress(this InputState input, Buttons button) + { + PlayerIndex p; + return input.IsNewButtonPress(button, PlayerIndex.One, out p); + } + + public static bool IsNewButtonRelease(this InputState input, Buttons button) + { + PlayerIndex p; + return input.IsNewButtonRelease(button, PlayerIndex.One, out p); + } + + public bool IsNewKeyRelease(this InputState input, Keys key) + { + PlayerIndex p; + return input.IsNewKeyRelease(key, PlayerIndex.One, out p); + } + } +}