diff --git a/axios/Axios_Windows.csproj.user b/axios/Axios_Windows.csproj.user index 566c009..76fe5a5 100644 --- a/axios/Axios_Windows.csproj.user +++ b/axios/Axios_Windows.csproj.user @@ -1,6 +1,6 @@  - ShowAllFiles + ProjectFiles \ No newline at end of file diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index b4f4453..003fd61 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.cs @@ -91,6 +91,7 @@ * - Fixing bug where loadrecentangleitem wouldn't be called by Gleed2D library * - Changing AxiosTitleFile.GetStream() to return Stream instead of FileStream * - Changing IAxiosFile.GetStream() to return Stream instead of FileStream + * - Adding support for XNACC * */ #endregion diff --git a/axios/ScreenSystem/InputState.cs b/axios/ScreenSystem/InputState.cs index 7fa2520..1ca51d7 100644 --- a/axios/ScreenSystem/InputState.cs +++ b/axios/ScreenSystem/InputState.cs @@ -15,6 +15,11 @@ using Microsoft.Xna.Framework.Input.Touch; using FarseerPhysics.SamplesFramework; using Microsoft.Xna.Framework.Graphics; using System; +#if WINDOWS +using XNACC.BaseTypes; +#endif +using System.Linq; + namespace GameStateManagement { @@ -37,8 +42,46 @@ namespace GameStateManagement /// query methods for high level input actions such as "move up through the menu" /// or "pause the game". /// +#if WINDOWS + public class InputState : IConsoleKeyboard +#else public class InputState +#endif { + +#if WINDOWS + #region XNACC + /* + * These are needed for XNACC + * -- Nathan Adams [adamsna@datanethost.net] - 5/26/2012 + */ + + private KeyboardState KeyState; + private List newlyPressedKeys = new List(); + private List heldKeys = new List(); + private Keys[] oldPressedKeys; + private Keys[] newPressedKeys; + + public KeyboardState CurrentKeyboardState + { + get { return KeyState; } + } + + public IList NewlyPressedKeys + { + get { return newlyPressedKeys; } + } + + public IList HeldKeys + { + get { return heldKeys; } + } + + /* + * End XNACC variables + */ + #endregion +#endif public const int MaxInputs = 4; public readonly KeyboardState[] CurrentKeyboardStates; @@ -270,6 +313,27 @@ namespace GameStateManagement /// public void Update(GameTime gameTime) { + +#if WINDOWS + #region XNACC + KeyState = Keyboard.GetState(); + + oldPressedKeys = newPressedKeys; + newPressedKeys = KeyState.GetPressedKeys(); + + newlyPressedKeys.Clear(); + heldKeys.Clear(); + + foreach (Keys key in newPressedKeys) + { + if (oldPressedKeys.Contains(key)) + heldKeys.Add(key); + else + newlyPressedKeys.Add(key); + } + #endregion +#endif + //PlayerIndex p; _lastMouseState = _currentMouseState; if (_handleVirtualStick) diff --git a/axios/XNACC/CommandConsoleBase.cs b/axios/XNACC/CommandConsoleBase.cs index 604b95e..c9930d6 100644 --- a/axios/XNACC/CommandConsoleBase.cs +++ b/axios/XNACC/CommandConsoleBase.cs @@ -11,7 +11,7 @@ using System.Threading; using System.IO; using System.ComponentModel; using System.Reflection; -using JRTS.XNA.Console.BaseTypes; +using XNACC.BaseTypes; using System.Diagnostics; #endif #endregion @@ -71,7 +71,7 @@ using System.Diagnostics; //NA: Seriously Microsoft? #if WINDOWS /// Namespace that contains code related to the XNACC (CommandConsole) component -namespace JRTS.XNA.Console +namespace XNACC.Console { /// Base functionality of the XNACC (CommandConsole) component public class CommandConsoleBase : DrawableGameComponent diff --git a/axios/XNACC/CommandConsoleBaseSharedTypes.cs b/axios/XNACC/CommandConsoleBaseSharedTypes.cs index 4b49338..e417d3d 100644 --- a/axios/XNACC/CommandConsoleBaseSharedTypes.cs +++ b/axios/XNACC/CommandConsoleBaseSharedTypes.cs @@ -6,7 +6,7 @@ using Microsoft.Xna.Framework.Input; #if WINDOWS /// Namespace that contains shared types related to the XNACC (CommandConsole) component -namespace JRTS.XNA.Console.BaseTypes +namespace XNACC.BaseTypes { #region IConsoleKeyboard /// Basic keyboard/input functionality required by the CommandConsole(Base) class