Otter
0.9.8.91
2d Game Development Framework based on SFML.Net
|
Component used for interpreting input as a button. It can recieve input from multiple sources including keyboard, mouse buttons, or joystick buttons and axes. The button input can also be controlled in code. More...
Inherits Otter.Component.
Public Member Functions | |
Button () | |
Create a Button. More... | |
Button (Button source) | |
Create a Button by copying another existing Button. More... | |
void | Reset () |
Reset the Button to report no input. More... | |
void | Clear () |
Clear all registered inputs for the Button. More... | |
Button | AddKey (params Key[] keys) |
Add a keyboard Key to the Button. More... | |
Button | AddMouseButton (params MouseButton[] mouseButtons) |
Add a mouse button to the Button. More... | |
Button | AddMouseWheel (MouseWheelDirection direction) |
Add the mouse wheel to the Button. More... | |
Button | AddJoyButton (int button, int joystick=0) |
Add a joystick button to the Button. More... | |
Button | AddButton (Button source) |
Add another Button into this Button. More... | |
Button | AddAxisButton (AxisButton button, int joystick=0) |
Add a joystick AxisButton to the Button. More... | |
void | ForceState (bool state) |
Force the state of the button. This will override player input. More... | |
void | ReleaseState () |
Release the button's state from forced control. Restores player input. More... | |
override void | UpdateFirst () |
Update the button status. More... | |
Public Member Functions inherited from Otter.Component | |
T | GetEntity< T > () |
Get the Entity as a specific Type. More... | |
virtual void | Added () |
Called when the Component is added to the Entity. More... | |
virtual void | Removed () |
Called when the Component is removed from the Entity. More... | |
void | RemoveSelf () |
Removes the Component from its parent Entity. More... | |
virtual void | Update () |
Called during the Update on the parent Entity. More... | |
virtual void | Render () |
Called during the Render on the parent Entity. More... | |
virtual void | UpdateLast () |
Called during the UpdateLast on the parent Entity. More... | |
T | GetComponent< T > () |
Gets the first Component of type T from this Component's Entity. More... | |
List< T > | GetComponents< T > () |
Gets a list of Components of type T from this Component's Entity. More... | |
Public Attributes | |
List< Key > | Keys = new List<Key>() |
The keys registered to the Button. More... | |
List< List< int > > | JoyButtons = new List<List<int>>() |
The joystick Buttons registered to the Button. More... | |
List< MouseButton > | MouseButtons = new List<MouseButton>() |
The mouse buttons registered to the Button. More... | |
List< MouseWheelDirection > | MouseWheel = new List<MouseWheelDirection>() |
The mouse wheel registered to the Button. More... | |
bool | Enabled = true |
Determines if the Button is enabled. If not enabled all tests return false. More... | |
float | LastPressed = float.MaxValue |
The time passed since the last button press. More... | |
float | LastReleased = float.MaxValue |
The time passed since the last button release. More... | |
Public Attributes inherited from Otter.Component | |
Entity | Entity |
The parent Entity of the Component. More... | |
bool | RenderAfterEntity = true |
Determines if the Component should render after the Entity has rendered. More... | |
bool | Visible = true |
Determines if the Component will render. More... | |
float | Timer = 0 |
How long the Component has been alive (added to an Entity and updated.) More... | |
Properties | |
bool | ForcedInput [get, set] |
If the button is currently controlled More... | |
bool | Pressed [get] |
Check if the button has been pressed. More... | |
bool | Released [get] |
Check if the button has been released. More... | |
bool | Down [get] |
Check if the button is down. More... | |
bool | Up [get] |
Check if the button is up. More... | |
Properties inherited from Otter.Component | |
int | InstanceId [get, set] |
The Component's id for the Entity its attached to. More... | |
Scene | Scene [get] |
The Scene that the parent Entity is in. More... | |
Collider | Collider [get] |
The first Collider of the parent Entity. More... | |
Graphic | Graphic [get] |
The first Graphic of the parent Entity. More... | |
List< Graphic > | Graphics [get] |
The list of Graphics from the parent Entity. More... | |
List< Collider > | Colliders [get] |
The list of Colliders from the parent Entity. More... | |
Component used for interpreting input as a button. It can recieve input from multiple sources including keyboard, mouse buttons, or joystick buttons and axes. The button input can also be controlled in code.
Otter.Button.Button | ( | ) |
Create a Button.
name | Optional string name of the button. |
Otter.Button.Button | ( | Button | source | ) |
Button Otter.Button.AddAxisButton | ( | AxisButton | button, |
int | joystick = 0 |
||
) |
Button Otter.Button.AddJoyButton | ( | int | button, |
int | joystick = 0 |
||
) |
Button Otter.Button.AddMouseButton | ( | params MouseButton[] | mouseButtons | ) |
Button Otter.Button.AddMouseWheel | ( | MouseWheelDirection | direction | ) |
void Otter.Button.Clear | ( | ) |
Clear all registered inputs for the Button.
void Otter.Button.ForceState | ( | bool | state | ) |
Force the state of the button. This will override player input.
state | The state of the button, true for down, false for up. |
void Otter.Button.ReleaseState | ( | ) |
Release the button's state from forced control. Restores player input.
void Otter.Button.Reset | ( | ) |
Reset the Button to report no input.
|
virtual |
Update the button status.
Reimplemented from Otter.Component.
bool Otter.Button.Enabled = true |
Determines if the Button is enabled. If not enabled all tests return false.
List<List<int> > Otter.Button.JoyButtons = new List<List<int>>() |
The joystick Buttons registered to the Button.
float Otter.Button.LastPressed = float.MaxValue |
The time passed since the last button press.
float Otter.Button.LastReleased = float.MaxValue |
The time passed since the last button release.
List<MouseButton> Otter.Button.MouseButtons = new List<MouseButton>() |
The mouse buttons registered to the Button.
List<MouseWheelDirection> Otter.Button.MouseWheel = new List<MouseWheelDirection>() |
The mouse wheel registered to the Button.
|
get |
Check if the button is down.
|
getset |
If the button is currently controlled
|
get |
Check if the button has been pressed.
|
get |
Check if the button has been released.
|
get |
Check if the button is up.