H073.Hx.HxTime
1.0.2
Prefix Reserved
See the version list below for details.
dotnet add package H073.Hx.HxTime --version 1.0.2
NuGet\Install-Package H073.Hx.HxTime -Version 1.0.2
<PackageReference Include="H073.Hx.HxTime" Version="1.0.2" />
paket add H073.Hx.HxTime --version 1.0.2
#r "nuget: H073.Hx.HxTime, 1.0.2"
// Install H073.Hx.HxTime as a Cake Addin #addin nuget:?package=H073.Hx.HxTime&version=1.0.2 // Install H073.Hx.HxTime as a Cake Tool #tool nuget:?package=H073.Hx.HxTime&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);
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. 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. |
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETCoreApp 3.1
- MonoGame.Framework.WindowsDX (>= 3.8.0.1641)
-
.NETFramework 4.7.2
- MonoGame.Framework.WindowsDX (>= 3.8.0.1641)
-
net5.0-windows7.0
- MonoGame.Framework.WindowsDX (>= 3.8.0.1641)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on H073.Hx.HxTime:
Package | Downloads |
---|---|
H073.Hx.HxSystem
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.