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

Component that represents an axis of input. Interprets both X and Y from -1 to 1. Can use multiple sources of input like keyboard, mouse buttons, or joystick axes and buttons. Input can also be delivered from code. More...

Inherits Otter.Component.

Public Member Functions

 Axis ()
 Create a new Axis. More...
 
 Axis (Key up, Key right, Key down, Key left)
 Create a new Axis using Keys. More...
 
 Axis (JoyAxis x, JoyAxis y, params int[] joystick)
 Create a new Axis using a joystick axis. More...
 
 Axis (AxisButton up, AxisButton right, AxisButton down, AxisButton left, params int[] joystick)
 Create a new Axis using AxisButtons. More...
 
void Reset ()
 Reset the Axis to report no input. More...
 
void Clear ()
 Clear all registered inputs for the Axis. More...
 
Axis AddJoyAxis (JoyAxis x, JoyAxis y, params int[] joystick)
 Add a joystick axis. More...
 
Axis AddAxis (Axis source)
 Add another Axis to this Axis. More...
 
Axis AddButton (int button, Direction direction, params int[] joystick)
 Add a joystick button. More...
 
Axis AddButton (AxisButton button, Direction direction, params int[] joystick)
 Add a joystick axis button. More...
 
Axis AddKey (Key key, Direction direction)
 Add a key. More...
 
Axis AddKeys (params Key[] upRightDownLeft)
 Add keys. More...
 
void ForceState (float x, float y)
 Force the axis state. More...
 
void ForceState (Vector2 xy)
 Force the axis state. More...
 
void ForceStateX (float x)
 Force the axis x state. More...
 
void ForceStateY (float y)
 Force the axis y state. More...
 
void ReleaseState ()
 Relinquish control of the axis back to input. More...
 
override void UpdateFirst ()
 Update the Axis. More...
 
override string ToString ()
 
- 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...
 

Static Public Member Functions

static Axis CreateArrowKeys ()
 Create a new Axis that uses the arrow keys for movement. More...
 
static Axis CreateWASD ()
 Create a new Axis that uses WASD for movement. More...
 

Public Attributes

Dictionary< Direction, List
< Key > > 
Keys = new Dictionary<Direction, List<Key>>()
 The Keys to uss. More...
 
Dictionary< Direction, List
< List< int > > > 
JoyButtons = new Dictionary<Direction, List<List<int>>>()
 The joystick buttons to use. More...
 
List< List< JoyAxis > > AxesX = new List<List<JoyAxis>>()
 The X axes to use. More...
 
List< List< JoyAxis > > AxesY = new List<List<JoyAxis>>()
 The Y axes to use. More...
 
bool Enabled = true
 Determines if the axis is currently enabled. If false, X and Y will report 0. More...
 
float DeadZone = 0.15f
 The range that must be exceeded by joysticks in order for their input to register. More...
 
bool RemapRange = true
 Determines if the DeadZone will be treated as 0 for joysticks. If true, remaps the range DeadZone to 100 to 0 to 1. If false, remaps the range 0 to 100 to 0 to 1. More...
 
bool RoundInput = true
 Determines if raw data coming from the joysticks should be rounded to 2 digits. More...
 
bool Locked = false
 Determines if input has any effect on the axis. When set to true the axis will remain at the X and Y it was at when locked. 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

Vector2 Position [get]
 The current Vector2 position of the axis. More...
 
float X [get, set]
 The X position of the axis from -1 to 1. More...
 
float Y [get, set]
 The Y position of the axis from -1 to 1. More...
 
float LastX [get, set]
 The previous X position of the axis. More...
 
float LastY [get, set]
 The previous Y position of the axis. More...
 
bool ForcedInput [get, set]
 Check if the axis is currently forced. More...
 
Button Up [get, set]
 The the up Button for the Axis. More...
 
Button Left [get, set]
 The the left Button for the Axis. More...
 
Button Down [get, set]
 Gets the down Button for the Axis. More...
 
Button Right [get, set]
 Gets the right Button for the Axis. More...
 
bool HasInput [get]
 Check if the axis has any means of input currently registered to it. More...
 
bool Neutral [get]
 Check of the axis is completely neutral. 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 that represents an axis of input. Interprets both X and Y from -1 to 1. Can use multiple sources of input like keyboard, mouse buttons, or joystick axes and buttons. Input can also be delivered from code.

Constructor & Destructor Documentation

Otter.Axis.Axis ( )

Create a new Axis.

Otter.Axis.Axis ( Key  up,
Key  right,
Key  down,
Key  left 
)

Create a new Axis using Keys.

Parameters
upThe Key for Up.
rightThe Key for Right.
downThe Key for Down.
leftThe Key for Left.
Otter.Axis.Axis ( JoyAxis  x,
JoyAxis  y,
params int[]  joystick 
)

Create a new Axis using a joystick axis.

Parameters
xThe JoyAxis to use for X.
yThe JoyAxis to use for Y.
joystickThe joystick id to use.
Otter.Axis.Axis ( AxisButton  up,
AxisButton  right,
AxisButton  down,
AxisButton  left,
params int[]  joystick 
)

Create a new Axis using AxisButtons.

Parameters
upThe AxisButton for Up.
rightThe AxisButton for Right.
downThe AxisButton for Down.
leftThe AxisButton for Left.
joystickThe joystick id to use.

Member Function Documentation

Axis Otter.Axis.AddAxis ( Axis  source)

Add another Axis to this Axis.

Parameters
sourceThe source Axis to use.
Returns
This Axis.
Axis Otter.Axis.AddButton ( int  button,
Direction  direction,
params int[]  joystick 
)

Add a joystick button.

Parameters
buttonThe joystick button id.
directionThe direction this button should effect.
joystickThe joystick id.
Returns
The Axis.
Axis Otter.Axis.AddButton ( AxisButton  button,
Direction  direction,
params int[]  joystick 
)

Add a joystick axis button.

Parameters
buttonThe joystick axis button.
directionThe direction this axis button should effect.
joystickThe joystick id.
Returns
The Axis.
Axis Otter.Axis.AddJoyAxis ( JoyAxis  x,
JoyAxis  y,
params int[]  joystick 
)

Add a joystick axis.

Parameters
xThe x axis of the joystick.
yThe y axis of the joystick.
joystickThe joystick id.
Returns
The Axis.
Axis Otter.Axis.AddKey ( Key  key,
Direction  direction 
)

Add a key.

Parameters
keyThe keyboard key.
directionThe direction this key should effect.
Returns
The Axis.
Axis Otter.Axis.AddKeys ( params Key[]  upRightDownLeft)

Add keys.

Parameters
upRightDownLeftFour keys to create a pair of axes from (Up, Right, Down, Left).
Returns
The Axis.
void Otter.Axis.Clear ( )

Clear all registered inputs for the Axis.

static Axis Otter.Axis.CreateArrowKeys ( )
static

Create a new Axis that uses the arrow keys for movement.

Returns
A new Axis.
static Axis Otter.Axis.CreateWASD ( )
static

Create a new Axis that uses WASD for movement.

Returns
A new Axis.
void Otter.Axis.ForceState ( float  x,
float  y 
)

Force the axis state.

Parameters
xThe forced x state.
yThe forced y state.
void Otter.Axis.ForceState ( Vector2  xy)

Force the axis state.

Parameters
xyThe forced x and y state.
void Otter.Axis.ForceStateX ( float  x)

Force the axis x state.

Parameters
xThe forced x state.
void Otter.Axis.ForceStateY ( float  y)

Force the axis y state.

Parameters
yThe forced y state.
void Otter.Axis.ReleaseState ( )

Relinquish control of the axis back to input.

void Otter.Axis.Reset ( )

Reset the Axis to report no input.

override void Otter.Axis.UpdateFirst ( )
virtual

Update the Axis.

Reimplemented from Otter.Component.

Member Data Documentation

List<List<JoyAxis> > Otter.Axis.AxesX = new List<List<JoyAxis>>()

The X axes to use.

List<List<JoyAxis> > Otter.Axis.AxesY = new List<List<JoyAxis>>()

The Y axes to use.

float Otter.Axis.DeadZone = 0.15f

The range that must be exceeded by joysticks in order for their input to register.

bool Otter.Axis.Enabled = true

Determines if the axis is currently enabled. If false, X and Y will report 0.

Dictionary<Direction, List<List<int> > > Otter.Axis.JoyButtons = new Dictionary<Direction, List<List<int>>>()

The joystick buttons to use.

Dictionary<Direction, List<Key> > Otter.Axis.Keys = new Dictionary<Direction, List<Key>>()

The Keys to uss.

bool Otter.Axis.Locked = false

Determines if input has any effect on the axis. When set to true the axis will remain at the X and Y it was at when locked.

bool Otter.Axis.RemapRange = true

Determines if the DeadZone will be treated as 0 for joysticks. If true, remaps the range DeadZone to 100 to 0 to 1. If false, remaps the range 0 to 100 to 0 to 1.

bool Otter.Axis.RoundInput = true

Determines if raw data coming from the joysticks should be rounded to 2 digits.

Property Documentation

Button Otter.Axis.Down
getset

Gets the down Button for the Axis.

bool Otter.Axis.ForcedInput
getset

Check if the axis is currently forced.

bool Otter.Axis.HasInput
get

Check if the axis has any means of input currently registered to it.

float Otter.Axis.LastX
getset

The previous X position of the axis.

float Otter.Axis.LastY
getset

The previous Y position of the axis.

Button Otter.Axis.Left
getset

The the left Button for the Axis.

bool Otter.Axis.Neutral
get

Check of the axis is completely neutral.

Vector2 Otter.Axis.Position
get

The current Vector2 position of the axis.

Button Otter.Axis.Right
getset

Gets the right Button for the Axis.

Button Otter.Axis.Up
getset

The the up Button for the Axis.

float Otter.Axis.X
getset

The X position of the axis from -1 to 1.

float Otter.Axis.Y
getset

The Y position of the axis from -1 to 1.


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