H073.Hx.HxSystem
1.0.3.2
Prefix Reserved
See the version list below for details.
dotnet add package H073.Hx.HxSystem --version 1.0.3.2
NuGet\Install-Package H073.Hx.HxSystem -Version 1.0.3.2
<PackageReference Include="H073.Hx.HxSystem" Version="1.0.3.2" />
paket add H073.Hx.HxSystem --version 1.0.3.2
#r "nuget: H073.Hx.HxSystem, 1.0.3.2"
// Install H073.Hx.HxSystem as a Cake Addin #addin nuget:?package=H073.Hx.HxSystem&version=1.0.3.2 // Install H073.Hx.HxSystem as a Cake Tool #tool nuget:?package=H073.Hx.HxSystem&version=1.0.3.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);
public void TextEntered(object sender, TextInputEventArgs e);
Example
How to process text input with keyboard
Game1 Class
public class Game1
{
/*
* Your Code
**/
Window.TextInput += InputManager.Instance.TextEntered; //Registers Methode To TextInput Event
}
TextInput Class - used in HxUserInterface (not released yet)
public string Text = "Text"; //Content Of The TextInput
public SpriteFont Font;
public bool Focus = false; //If The TextInput Has Focus
public bool Edit = false; //If The TextInput Can Be Edited
public TextInput()
{
Input.Instance.OnCharDown += OnInput;
}
public void Update(GameTime gameTime);
public void Draw(SpriteBatch spriteBatch, GameTime gameTime);
private void OnInput(object sender, KeyboardCharEventArgs e)
{
if (!Focus)
{
return;
}
switch (e.Char)
{
case '\a':
break;
case '\f':
break;
case '\r':
break;
case '\n':
break;
case '\t':
break;
case '\v':
break;
case '\0':
break;
case '\x1B':
break;
case ' ':
Text = Text?.Insert(Text.Length, " ");
break;
case '\b':
{
if (Text.Length - 1 >= 0)
{
Text = Text?.Remove(Text.Length - 1);
}
break;
}
default:
if (Font.Characters.Contains(e.Char))
{
Text = Text?.Insert(Text.Length, e.Char.ToString());
}
break;
}
}
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 | Versions 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. |
-
.NETCoreApp 3.1
- H073.Hx.HxInput (>= 1.0.2.2)
- H073.Hx.HxManager (>= 1.0.1)
- H073.Hx.HxTime (>= 1.0.0)
- MonoGame.Framework.WindowsDX (>= 3.8.0.1641)
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 | 314 | 12/26/2021 | |
1.0.6 | 241 | 12/26/2021 | |
1.0.5.1 | 273 | 12/26/2021 | |
1.0.5 | 294 | 12/26/2021 | |
1.0.4.4 | 304 | 12/17/2021 | |
1.0.4.2 | 274 | 12/16/2021 | |
1.0.4.1 | 281 | 12/7/2021 | |
1.0.4 | 276 | 12/6/2021 | |
1.0.3.4 | 539 | 12/6/2021 | |
1.0.3.3 | 299 | 12/6/2021 | |
1.0.3.2 | 301 | 12/6/2021 | |
1.0.3.1 | 303 | 12/5/2021 | |
1.0.3 | 290 | 12/5/2021 | |
1.0.2 | 307 | 12/5/2021 | |
1.0.1 | 297 | 12/5/2021 | |
1.0.0 | 306 | 12/4/2021 |