Class Input
Provides utility methods for handling user input in the Genesis framework.
Inherited Members
Namespace: Genesis.Core
Assembly: Genesis.dll
Syntax
public class Input
Constructors
Input()
Declaration
public Input()
Methods
GetAsyncKeyState(int)
Gets the state of the specified key.
Declaration
public static extern short GetAsyncKeyState(int vKey)
Parameters
Type | Name | Description |
---|---|---|
int | vKey | The virtual key code to check. |
Returns
Type | Description |
---|---|
short | True if the key is down; otherwise, false. |
GetAsyncKeyState(Keys)
Gets the state of the specified key.
Declaration
public static extern short GetAsyncKeyState(Keys vKey)
Parameters
Type | Name | Description |
---|---|---|
Keys | vKey | The virtual key code to check. |
Returns
Type | Description |
---|---|
short | True if the key is down; otherwise, false. |
GetMousePos()
Gets the current mouse position.
Declaration
public static Vec3 GetMousePos()
Returns
Type | Description |
---|---|
Vec3 | A Vec3 representing the current mouse position. |
GetRefMousePos(Game)
Gets the mouse position relative to the control associated with the specified game instance.
Declaration
public static Vec3 GetRefMousePos(Game game)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
Returns
Type | Description |
---|---|
Vec3 | A Vec3 representing the mouse position relative to the control. |
GetRefMousePos(IntPtr)
Gets the mouse position relative to the control associated with the specified handle.
Declaration
public static Vec3 GetRefMousePos(IntPtr handle)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | handle | The handle of the control. |
Returns
Type | Description |
---|---|
Vec3 | A Vec3 representing the mouse position relative to the control. |
GetRefMousePos(Control)
Gets the mouse position relative to the specified control.
Declaration
public static Vec3 GetRefMousePos(Control control)
Parameters
Type | Name | Description |
---|---|---|
Control | control | The control relative to which the mouse position is obtained. |
Returns
Type | Description |
---|---|
Vec3 | A Vec3 representing the mouse position relative to the control. |
HideCursor()
Hides the cursor.
Declaration
public static void HideCursor()
IsKeyDown(Keys)
Checks whether the specified key is currently pressed.
Declaration
public static bool IsKeyDown(Input.Keys vKey)
Parameters
Type | Name | Description |
---|---|---|
Input.Keys | vKey | The virtual key to check. |
Returns
Type | Description |
---|---|
bool |
|
Examples
This example demonstrates how to use IsKeyDown method:
if (Input.IsKeyDown(Input.Keys.A))
{
Console.WriteLine("Key A is pressed.");
}
IsKeyDown(Keys)
Checks if the specified key is currently pressed.
Declaration
public static bool IsKeyDown(Keys vKey)
Parameters
Type | Name | Description |
---|---|---|
Keys | vKey | The virtual key to check. |
Returns
Type | Description |
---|---|
bool | True if the key is down; otherwise, false. |
SetCursorPos(Vec3, IntPtr)
Sets the cursor position on the screen.
Declaration
public static void SetCursorPos(Vec3 pos, IntPtr handle)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | pos | The new position of the cursor. |
IntPtr | handle | The handle of the control where the cursor position will be set. |
SetCursorPos(int, int)
Sets the cursor position on the screen.
Declaration
public static extern bool SetCursorPos(int X, int Y)
Parameters
Type | Name | Description |
---|---|---|
int | X | The new x-coordinate of the cursor position. |
int | Y | The new y-coordinate of the cursor position. |
Returns
Type | Description |
---|---|
bool |
SetCursorPos(int, int, IntPtr)
Sets the cursor position on the screen.
Declaration
public static void SetCursorPos(int x, int y, IntPtr handle)
Parameters
Type | Name | Description |
---|---|---|
int | x | |
int | y | |
IntPtr | handle | The handle of the control where the cursor position will be set. |
ShowCursor()
Shows the cursor.
Declaration
public static void ShowCursor()