Character freezing + Misc fixes

This commit is contained in:
juanjp600
2016-09-21 16:46:12 -03:00
parent 3314c8501c
commit edab86f730
9 changed files with 70 additions and 9 deletions

View File

@@ -204,6 +204,7 @@ namespace Barotrauma
public static class PlayerInput
{
static MouseState mouseState, oldMouseState;
static MouseState latestMouseState; //the absolute latest state, do NOT use for player interaction
static KeyboardState keyboardState, oldKeyboardState;
static double timeSinceClick;
@@ -219,6 +220,11 @@ namespace Barotrauma
get { return new Vector2(mouseState.Position.X, mouseState.Position.Y); }
}
public static Vector2 LatestMousePosition
{
get { return new Vector2(latestMouseState.Position.X, latestMouseState.Position.Y); }
}
//public static MouseState GetMouseState
//{
// get { return mouseState; }
@@ -334,7 +340,8 @@ namespace Barotrauma
timeSinceClick += deltaTime;
oldMouseState = mouseState;
mouseState = Mouse.GetState();
mouseState = latestMouseState;
UpdateVariable();
oldKeyboardState = keyboardState;
keyboardState = Keyboard.GetState();
@@ -346,5 +353,12 @@ namespace Barotrauma
timeSinceClick = 0.0;
}
}
public static void UpdateVariable()
{
//do NOT use this for actual interaction with the game, this is to be used for debugging and rendering ONLY
latestMouseState = Mouse.GetState();
}
}
}