Otter  0.9.8.91
2d Game Development Framework based on SFML.Net
 All Classes Namespaces Functions Variables Enumerations Properties
Otter.Button Class Reference

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
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...
 
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< KeyKeys = 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< MouseButtonMouseButtons = new List<MouseButton>()
 The mouse buttons registered to the Button. More...
 
List< MouseWheelDirectionMouseWheel = 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< GraphicGraphics [get]
 The list of Graphics from the parent Entity. More...
 
List< ColliderColliders [get]
 The list of Colliders from the parent Entity. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

Otter.Button.Button ( )

Create a Button.

Parameters
nameOptional string name of the button.
Otter.Button.Button ( Button  source)

Create a Button by copying another existing Button.

Parameters
sourceThe Button to copy.

Member Function Documentation

Button Otter.Button.AddAxisButton ( AxisButton  button,
int  joystick = 0 
)

Add a joystick AxisButton to the Button.

Parameters
buttonThe AxisButton to add.
joystickThe joystick id of the button to add.
Returns
The Button.
Button Otter.Button.AddButton ( Button  source)

Add another Button into this Button.

Parameters
sourceThe Button to add into this Button.
Returns
The Button.
Button Otter.Button.AddJoyButton ( int  button,
int  joystick = 0 
)

Add a joystick button to the Button.

Parameters
buttonThe joystick button to add.
joystickThe joystick id of the button to add.
Returns
The Button.
Button Otter.Button.AddKey ( params Key[]  keys)

Add a keyboard Key to the Button.

Parameters
keysThe key to add.
Returns
The Button.
Button Otter.Button.AddMouseButton ( params MouseButton[]  mouseButtons)

Add a mouse button to the Button.

Parameters
mouseButtonsThe mouse button to add.
Returns
The Button.
Button Otter.Button.AddMouseWheel ( MouseWheelDirection  direction)

Add the mouse wheel to the Button.

Parameters
directionThe mouse wheel direction to add.
Returns
The Button.
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.

Parameters
stateThe 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.

override void Otter.Button.UpdateFirst ( )
virtual

Update the button status.

Reimplemented from Otter.Component.

Member Data Documentation

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.

List<Key> Otter.Button.Keys = new List<Key>()

The keys 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.

Property Documentation

bool Otter.Button.Down
get

Check if the button is down.

bool Otter.Button.ForcedInput
getset

If the button is currently controlled

bool Otter.Button.Pressed
get

Check if the button has been pressed.

bool Otter.Button.Released
get

Check if the button has been released.

bool Otter.Button.Up
get

Check if the button is up.


The documentation for this class was generated from the following file: