v0.3.0.3: ignoring input if window isn't active

This commit is contained in:
Regalis
2016-01-28 21:49:52 +02:00
parent d8149ffaa2
commit f5c2dbf22a
5 changed files with 31 additions and 16 deletions
+2 -2
View File
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.0.2")] [assembly: AssemblyVersion("0.3.0.3")]
[assembly: AssemblyFileVersion("0.3.0.2")] [assembly: AssemblyFileVersion("0.3.0.3")]
+5
View File
@@ -22,6 +22,11 @@ namespace Barotrauma
public static GameMain Instance; public static GameMain Instance;
public static bool WindowActive
{
get { return Instance == null ? true : GameMain.Instance.IsActive; }
}
public static bool DebugDraw; public static bool DebugDraw;
public static GraphicsDevice CurrGraphicsDevice; public static GraphicsDevice CurrGraphicsDevice;
+14 -14
View File
@@ -232,7 +232,7 @@ namespace Barotrauma
{ {
get get
{ {
return GameMain.Instance.IsActive ? MousePosition - new Vector2(oldMouseState.X, oldMouseState.Y) : Vector2.Zero; return GameMain.WindowActive ? MousePosition - new Vector2(oldMouseState.X, oldMouseState.Y) : Vector2.Zero;
} }
} }
@@ -248,72 +248,72 @@ namespace Barotrauma
public static int ScrollWheelSpeed public static int ScrollWheelSpeed
{ {
get { return GameMain.Instance.IsActive ? mouseState.ScrollWheelValue - oldMouseState.ScrollWheelValue : 0; } get { return GameMain.WindowActive ? mouseState.ScrollWheelValue - oldMouseState.ScrollWheelValue : 0; }
} }
public static bool LeftButtonDown() public static bool LeftButtonDown()
{ {
return GameMain.Instance.IsActive && mouseState.LeftButton == ButtonState.Pressed; return GameMain.WindowActive && mouseState.LeftButton == ButtonState.Pressed;
} }
public static bool LeftButtonReleased() public static bool LeftButtonReleased()
{ {
return GameMain.Instance.IsActive && mouseState.LeftButton == ButtonState.Released; return GameMain.WindowActive && mouseState.LeftButton == ButtonState.Released;
} }
public static bool LeftButtonClicked() public static bool LeftButtonClicked()
{ {
return (GameMain.Instance.IsActive && return (GameMain.WindowActive &&
oldMouseState.LeftButton == ButtonState.Pressed oldMouseState.LeftButton == ButtonState.Pressed
&& mouseState.LeftButton == ButtonState.Released); && mouseState.LeftButton == ButtonState.Released);
} }
public static bool RightButtonDown() public static bool RightButtonDown()
{ {
return GameMain.Instance.IsActive && mouseState.RightButton == ButtonState.Pressed; return GameMain.WindowActive && mouseState.RightButton == ButtonState.Pressed;
} }
public static bool RightButtonClicked() public static bool RightButtonClicked()
{ {
return (GameMain.Instance.IsActive && return (GameMain.WindowActive &&
oldMouseState.RightButton == ButtonState.Pressed oldMouseState.RightButton == ButtonState.Pressed
&& mouseState.RightButton == ButtonState.Released); && mouseState.RightButton == ButtonState.Released);
} }
public static bool DoubleClicked() public static bool DoubleClicked()
{ {
return GameMain.Instance.IsActive && doubleClicked; return GameMain.WindowActive && doubleClicked;
} }
public static bool KeyHit(InputType inputType) public static bool KeyHit(InputType inputType)
{ {
return GameMain.Instance.IsActive && GameMain.Config.KeyBind(inputType).IsHit(); return GameMain.WindowActive && GameMain.Config.KeyBind(inputType).IsHit();
} }
public static bool KeyDown(InputType inputType) public static bool KeyDown(InputType inputType)
{ {
return GameMain.Instance.IsActive && GameMain.Config.KeyBind(inputType).IsDown(); return GameMain.WindowActive && GameMain.Config.KeyBind(inputType).IsDown();
} }
public static bool KeyUp(InputType inputType) public static bool KeyUp(InputType inputType)
{ {
return GameMain.Instance.IsActive && !GameMain.Config.KeyBind(inputType).IsDown(); return GameMain.WindowActive && !GameMain.Config.KeyBind(inputType).IsDown();
} }
public static bool KeyHit(Keys button) public static bool KeyHit(Keys button)
{ {
return (GameMain.Instance.IsActive && oldKeyboardState.IsKeyDown(button) && keyboardState.IsKeyUp(button)); return (GameMain.WindowActive && oldKeyboardState.IsKeyDown(button) && keyboardState.IsKeyUp(button));
} }
public static bool KeyDown(Keys button) public static bool KeyDown(Keys button)
{ {
return (GameMain.Instance.IsActive && keyboardState.IsKeyDown(button)); return (GameMain.WindowActive && keyboardState.IsKeyDown(button));
} }
public static bool KeyUp(Keys button) public static bool KeyUp(Keys button)
{ {
return GameMain.Instance.IsActive && keyboardState.IsKeyUp(button); return GameMain.WindowActive && keyboardState.IsKeyUp(button);
} }
public static void Update(double deltaTime) public static void Update(double deltaTime)
+10
View File
@@ -1,3 +1,13 @@
---------------------------------------------------------------------------------------------------------
v0.3.0.3
---------------------------------------------------------------------------------------------------------
- fixed selecting stairs and items outside the sub in editor
- fixed crashing when pressing the ''start'' button while no route is chosen in single player
- fixed fire syncing
- fixed another bug that crashed the game if in the lobby when a round ends
- camera keeps moving with the sub when typing into chatbox in spectator mode
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.3.0.2 v0.3.0.2
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
Binary file not shown.