H073.Hx.HxSystem 1.0.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package H073.Hx.HxSystem --version 1.0.2                
NuGet\Install-Package H073.Hx.HxSystem -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="H073.Hx.HxSystem" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add H073.Hx.HxSystem --version 1.0.2                
#r "nuget: H073.Hx.HxSystem, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install H073.Hx.HxSystem as a Cake Addin
#addin nuget:?package=H073.Hx.HxSystem&version=1.0.2

// Install H073.Hx.HxSystem as a Cake Tool
#tool nuget:?package=H073.Hx.HxSystem&version=1.0.2                

HxNuGet

Documentation on how to use each HxNuGet package

HxInput

Dependencies

TODO

Events

public event EventHandler<KeyboardKeyEventArgs> OnKeyDown;
public event EventHandler<KeyboardKeyEventArgs> OnKeyUp;

public event EventHandler<KeyboardCharEventArgs> OnCharDown;

public event EventHandler<MouseMoveEventArgs> OnMouseMove;

public event EventHandler<GamePadEventArgs> OnGamePadConnect;
public event EventHandler<GamePadEventArgs> OnGamePadDisconnect;

Public

public Vector2 LatestMouseDelta;

public Point LatestMousePosition;
public Point PreviousMousePosition;

public MouseState LatestMouseState;
public MouseState PreviousMouseState;

public TouchPanelState LatestTouchPanelState;
public TouchPanelState PreviousTouchPanelState;

public TouchCollection LatestTouchCollection;
public TouchCollection PreviousTouchCollection;

public KeyboardState LatestKeyboardState;
public KeyboardState PreviousKeyboardState;

public GamePadState[] LatestGamePadStates;
public GamePadState[] PreviousGamePadStates;

How to use

Update Input

If you use HxInput without HxSystem then you have to call this code to update the input device states

Input.Instance.Update(gameTime);

If you use HxInput with HxSystem then you have to call this code to update the input device states

Hx.Instance.Update(gameTime);

Mouse Input

public Vector2 MouseDistanceVectorFrom(Vector2 position);
public Vector2 MouseDistanceVectorFrom(Point position);
public Point MouseDistancePointFrom(Vector2 position);
public Point MouseDistancePointFrom(Point position);
public bool IsMouseKeyDownOnce(MouseButton button);
public bool IsMouseKeyDown(MouseButton button);
public bool IsMouseKeyUpOnce(MouseButton button);
public bool IsMouseKeyUp(MouseButton button);

Keyboard Input

public bool IsKeyboardKeyDownOnce(Keys key);
public bool IsKeyboardKeyDown(Keys key);
public bool WasKeyboardKeyDown(Keys key);
public bool IsKeyboardKeyUpOnce(Keys key);
public bool IsKeyboardKeyUp(Keys key);
public bool WasKeyboardKeyUp(Keys key);
Example

This code prints "Key Pressed" only one time when the key "G" was pressed

Using OnKeyDown Event

public void foo(object sender, KeyboardKeyEventArgs args)
{
    if (args.Key == Keys.G)
    {
        Console.WriteLine("Key Pressed");
    }
}

//Somewhere in the code
Input.Instance.OnKeyDown += foo;

Using IsKeyboardeKeyDownOnce Method

if (Input.Instance.IsKeyboardeKeyDownOnce(Keys.G))
{
  Console.WriteLine("Key Pressed");
}

GamePad Input

public bool IsGamepadButtonDown(PlayerIndex index, Buttons button);
public bool IsGamepadButtonUp(PlayerIndex index, Buttons button);
public bool WasGamepadButtonDown(PlayerIndex index, Buttons button);
public bool WasButtonUp(PlayerIndex index, Buttons button);
public bool IsGamepadButtonPressed(PlayerIndex index, Buttons button);
public bool IsButtonReleased(PlayerIndex index, Buttons button);
public bool IsGamePadConnected(PlayerIndex index);
public bool WasGamePadConnected(PlayerIndex index);
public bool IsGamePadDisconnected(PlayerIndex index);
public bool WasGamePadDisconnected(PlayerIndex index);

Touch Input

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.6.1 313 12/26/2021
1.0.6 240 12/26/2021
1.0.5.1 270 12/26/2021 1.0.5.1 is deprecated because it has critical bugs.
1.0.5 293 12/26/2021 1.0.5 is deprecated.
1.0.4.4 303 12/17/2021
1.0.4.2 273 12/16/2021
1.0.4.1 280 12/7/2021
1.0.4 275 12/6/2021
1.0.3.4 539 12/6/2021
1.0.3.3 298 12/6/2021
1.0.3.2 300 12/6/2021
1.0.3.1 302 12/5/2021
1.0.3 289 12/5/2021
1.0.2 304 12/5/2021
1.0.1 296 12/5/2021
1.0.0 305 12/4/2021