Otter
0.9.8.91
2d Game Development Framework based on SFML.Net
|
Class used for managing input from the keyboard, mouse, and joysticks. Updated by the active Game. More...
Public Member Functions | |
bool | KeyPressed (Key k) |
Check if a key has been pressed this update. More... | |
bool | KeyPressed (char c) |
Check if a key has been pressed this update. More... | |
bool | KeyReleased (Key k) |
Check if a key has been released this update. More... | |
bool | KeyReleased (char c) |
Check if a key has been released this update. More... | |
bool | KeyDown (Key k) |
Check if a key is currently down. More... | |
bool | KeyDown (char c) |
Check if a key is currently down. More... | |
bool | KeyUp (Key k) |
Check if a key is currently up. More... | |
bool | KeyUp (char c) |
Check if a key is currently up. More... | |
bool | ButtonPressed (int button, int joystick=0) |
Check if a joystick button is pressed. More... | |
bool | ButtonPressed (AxisButton button, int joystick=0) |
Check if a joystick AxisButton is pressed. More... | |
bool | ButtonReleased (int button, int joystick=0) |
Check if the joystick button is released. More... | |
bool | ButtonReleased (AxisButton button, int joystick=0) |
Check if the joystick AxisButton is released. More... | |
bool | ButtonDown (int button, int joystick=0) |
Check if the joystick button is down. More... | |
bool | ButtonDown (AxisButton button, int joystick=0) |
Check if the joystick AxisButton is down. More... | |
bool | ButtonUp (int button, int joystick=0) |
Check if the joystick button is up. More... | |
bool | ButtonUp (AxisButton button, int joystick=0) |
Check if the joystick button is up. More... | |
float | GetAxis (JoyAxis axis, int joystick=0) |
Get the value of a joystick axis from -100 to 100. More... | |
void | SetAxisThreshold (JoyAxis axis, float threshold) |
Set the threshold for an axis to act as an AxisButton. Defaults to 50 or one half of the joystick's total range. More... | |
float | GetAxisThreshold (JoyAxis axis) |
Gets the axis threshold for an axis to act as an AxisButton. More... | |
bool | MouseButtonPressed (MouseButton b) |
Check if a MouseButton is pressed. More... | |
bool | MouseButtonReleased (MouseButton b) |
Check if a MouseButton is pressed. More... | |
bool | MouseButtonDown (MouseButton b) |
Check if a MouseButton is pressed. More... | |
bool | MouseButtonUp (MouseButton b) |
Check if a MouseButton is pressed. More... | |
void | ClearKeystring () |
Clear the string of recently pressed keys. More... | |
Static Public Member Functions | |
static Key | CharToKey (char key) |
Convert a char to a Key code. More... | |
static string | GetJoystickName (int id) |
Get the name of the Joystick. More... | |
static int | GetJoystickVendorId (int id) |
Get the vendor id of the Joystick. More... | |
static int | GetJoystickProductId (int id) |
Get the product id of the Joystick. More... | |
Public Attributes | |
string | KeyString = "" |
The current string of keys that were pressed. More... | |
Static Public Attributes | |
static Input | Instance |
A reference to the current active instance. More... | |
static int | KeystringSize = 500 |
The maximum size of the string of recent key presses. More... | |
static bool | CenteredMouse = false |
Determines if the mouse should be locked to the center of the screen. More... | |
Properties | |
static int | JoysticksConnected [get] |
The current number of joysticks connected. More... | |
static int | JoysticksSupported [get] |
The maximum possible amount of joysticks that can be connected. More... | |
Game | Game [get, set] |
The reference to the game that owns this class. More... | |
Key | LastKey [get, set] |
The last known key that was pressed. More... | |
MouseButton | LastMouseButton [get, set] |
The last known mouse button that was pressed. More... | |
List< int > | LastButton [get, set] |
The last known button pressed on each joystick. More... | |
int | MouseDeltaX [get, set] |
The X movement of the mouse since the last update. Only updates if the mouse is locked inside the Game window. More... | |
int | MouseDeltaY [get, set] |
The Y movement of the mouse since the last update. Only updates if the mouse is locked inside the Game window. More... | |
int | MouseX [get] |
The current X position of the mouse. More... | |
int | MouseY [get] |
The current Y position of the mouse. More... | |
int | MouseRawX [get, set] |
The raw X position of the mouse. This can be set. More... | |
int | MouseRawY [get, set] |
The raw Y position of the mouse. This can be set. More... | |
float | MouseScreenX [get] |
The X position of the mouse in screen space. More... | |
float | MouseScreenY [get] |
The Y position of the mouse in screen space. More... | |
float | MouseWheelDelta [get] |
The change in the mouse wheel value this update. More... | |
int | GameMouseX [get, set] |
The X position of the mouse in the game. Use if the mouse is locked in the game window. This can be set if the mouse is locked inside the game window. More... | |
int | GameMouseY [get, set] |
The Y position of the mouse in the game. Use if the mouse is locked in the game window. This can be set if the mouse is locked inside the game window. More... | |
Class used for managing input from the keyboard, mouse, and joysticks. Updated by the active Game.
bool Otter.Input.ButtonDown | ( | int | button, |
int | joystick = 0 |
||
) |
Check if the joystick button is down.
button | The button to check. |
joystick | The joystick to check. |
bool Otter.Input.ButtonDown | ( | AxisButton | button, |
int | joystick = 0 |
||
) |
Check if the joystick AxisButton is down.
button | The AxisButton to check. |
joystick | The joystick to check. |
bool Otter.Input.ButtonPressed | ( | int | button, |
int | joystick = 0 |
||
) |
Check if a joystick button is pressed.
button | The button to check. |
joystick | The joystick to check. |
bool Otter.Input.ButtonPressed | ( | AxisButton | button, |
int | joystick = 0 |
||
) |
Check if a joystick AxisButton is pressed.
button | The AxisButton to check. |
joystick | The joystick to check. |
bool Otter.Input.ButtonReleased | ( | int | button, |
int | joystick = 0 |
||
) |
Check if the joystick button is released.
button | The button to check. |
joystick | The joystick to check. |
bool Otter.Input.ButtonReleased | ( | AxisButton | button, |
int | joystick = 0 |
||
) |
Check if the joystick AxisButton is released.
button | The AxisButton to check. |
joystick | The joystick to check. |
bool Otter.Input.ButtonUp | ( | int | button, |
int | joystick = 0 |
||
) |
Check if the joystick button is up.
button | The button to check. |
joystick | The joystick to check. |
bool Otter.Input.ButtonUp | ( | AxisButton | button, |
int | joystick = 0 |
||
) |
Check if the joystick button is up.
button | The AxisButton to check. |
joystick | The joystick to check. |
|
static |
Convert a char to a Key code.
key | The char to convert into a Key. |
void Otter.Input.ClearKeystring | ( | ) |
Clear the string of recently pressed keys.
float Otter.Input.GetAxis | ( | JoyAxis | axis, |
int | joystick = 0 |
||
) |
Get the value of a joystick axis from -100 to 100.
axis | The axis to check. |
joystick | The joystick to check. |
float Otter.Input.GetAxisThreshold | ( | JoyAxis | axis | ) |
Gets the axis threshold for an axis to act as an AxisButton.
axis | The JoyAxis. |
|
static |
Get the name of the Joystick.
id | The connection id of the Joystick. |
|
static |
Get the product id of the Joystick.
id | The connection id of the Joystick. |
|
static |
Get the vendor id of the Joystick.
id | The connection id of the Joystick. |
bool Otter.Input.KeyDown | ( | Key | k | ) |
Check if a key is currently down.
k | The key to check. |
bool Otter.Input.KeyDown | ( | char | c | ) |
Check if a key is currently down.
c | The key to check. |
bool Otter.Input.KeyPressed | ( | Key | k | ) |
Check if a key has been pressed this update.
k | The key to check. |
bool Otter.Input.KeyPressed | ( | char | c | ) |
Check if a key has been pressed this update.
c | The key to check. |
bool Otter.Input.KeyReleased | ( | Key | k | ) |
Check if a key has been released this update.
k | The key to check. |
bool Otter.Input.KeyReleased | ( | char | c | ) |
Check if a key has been released this update.
c | The key to check. |
bool Otter.Input.KeyUp | ( | Key | k | ) |
Check if a key is currently up.
k | The key to check. |
bool Otter.Input.KeyUp | ( | char | c | ) |
Check if a key is currently up.
c | The key to check. |
bool Otter.Input.MouseButtonDown | ( | MouseButton | b | ) |
Check if a MouseButton is pressed.
b | The MouseButton to check. |
bool Otter.Input.MouseButtonPressed | ( | MouseButton | b | ) |
Check if a MouseButton is pressed.
b | The MouseButton to check. |
bool Otter.Input.MouseButtonReleased | ( | MouseButton | b | ) |
Check if a MouseButton is pressed.
b | The MouseButton to check. |
bool Otter.Input.MouseButtonUp | ( | MouseButton | b | ) |
Check if a MouseButton is pressed.
b | The MouseButton to check. |
void Otter.Input.SetAxisThreshold | ( | JoyAxis | axis, |
float | threshold | ||
) |
Set the threshold for an axis to act as an AxisButton. Defaults to 50 or one half of the joystick's total range.
axis | The JoyAxis to set. |
threshold | The threshold that the axis must pass to act as a button press. |
|
static |
Determines if the mouse should be locked to the center of the screen.
|
static |
A reference to the current active instance.
string Otter.Input.KeyString = "" |
The current string of keys that were pressed.
|
static |
The maximum size of the string of recent key presses.
|
getset |
The reference to the game that owns this class.
|
getset |
The X position of the mouse in the game. Use if the mouse is locked in the game window. This can be set if the mouse is locked inside the game window.
|
getset |
The Y position of the mouse in the game. Use if the mouse is locked in the game window. This can be set if the mouse is locked inside the game window.
|
staticget |
The current number of joysticks connected.
|
staticget |
The maximum possible amount of joysticks that can be connected.
|
getset |
The last known button pressed on each joystick.
|
getset |
The last known key that was pressed.
|
getset |
The last known mouse button that was pressed.
|
getset |
The X movement of the mouse since the last update. Only updates if the mouse is locked inside the Game window.
|
getset |
The Y movement of the mouse since the last update. Only updates if the mouse is locked inside the Game window.
|
getset |
The raw X position of the mouse. This can be set.
|
getset |
The raw Y position of the mouse. This can be set.
|
get |
The X position of the mouse in screen space.
|
get |
The Y position of the mouse in screen space.
|
get |
The change in the mouse wheel value this update.
|
get |
The current X position of the mouse.
|
get |
The current Y position of the mouse.