H073.Hx.HxManager 1.0.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package H073.Hx.HxManager --version 1.0.1                
NuGet\Install-Package H073.Hx.HxManager -Version 1.0.1                
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.HxManager" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add H073.Hx.HxManager --version 1.0.1                
#r "nuget: H073.Hx.HxManager, 1.0.1"                
#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.HxManager as a Cake Addin
#addin nuget:?package=H073.Hx.HxManager&version=1.0.1

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

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.  net5.0-windows7.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on H073.Hx.HxManager:

Package Downloads
H073.Hx.HxSystem

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3.1 292 12/29/2021
1.0.3 595 12/25/2021
1.0.2 716 12/6/2021
1.0.1 1,057 12/5/2021
1.0.0 274 12/5/2021