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

Component representing a group of Button and Axis classes. The controller updates all buttons and axes manually. This is used by the Session class to manage player input. More...

Inherits Otter.Component.

Inherited by Otter.ControllerPS3, and Otter.ControllerXbox360.

Public Member Functions

 Controller (params int[] joystickId)
 
Button Button (Enum name)
 
Button Button (string name)
 
Axis Axis (Enum name)
 
Axis Axis (string name)
 
Controller AddButton (Enum name, Button b=null)
 
Controller AddButton (params Enum[] names)
 
Controller AddButton (params string[] names)
 
Controller AddButton (string name, Button b=null)
 
Controller AddAxis (Enum name, Axis a=null)
 
Controller AddAxis (string name, Axis a=null)
 
Controller AddAxis (params Enum[] names)
 
Controller AddAxis (params string[] names)
 
void Clear ()
 
override void UpdateFirst ()
 Called during the UpdateFirst on the parent Entity. More...
 
void Record ()
 Record the input to a string. Optionally save it out to a file when finished. More...
 
void Playback (string source)
 Play back recorded input data. More...
 
void PlaybackFile (string path)
 Playbacks the recorded input data loaded from a file path. More...
 
void SaveRecording (string path="")
 Save the last recorded input data to a file. More...
 
void Stop ()
 Stop the recording or playback of the controller. This will also release input states. More...
 
void Disable ()
 
void Enable ()
 
- 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< int > JoystickIds = new List<int>()
 The joystick id associated with this controller. More...
 
bool Enabled = true
 Determines if the controller is enabled. If not, all buttons return false, and all axes return 0, 0. More...
 
bool RecordAxes = true
 If the controller should record axes data. 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 Recording [get, set]
 If the controller is currently recording input. More...
 
bool Playing [get, set]
 If the controller is currently playing input data. More...
 
string LastRecordedString [get]
 The last recorded data as a compressed string. 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 representing a group of Button and Axis classes. The controller updates all buttons and axes manually. This is used by the Session class to manage player input.

Input recording should only be used in fixed framerate games! If used with variable framerate the playback is not reliable.

Member Function Documentation

void Otter.Controller.Playback ( string  source)

Play back recorded input data.

Parameters
sourceThe recorded data.
void Otter.Controller.PlaybackFile ( string  path)

Playbacks the recorded input data loaded from a file path.

Parameters
pathThe path to the file relative to Game.Filepath.
void Otter.Controller.Record ( )

Record the input to a string. Optionally save it out to a file when finished.

void Otter.Controller.SaveRecording ( string  path = "")

Save the last recorded input data to a file.

Parameters
pathThe path to save the data to.
void Otter.Controller.Stop ( )

Stop the recording or playback of the controller. This will also release input states.

override void Otter.Controller.UpdateFirst ( )
virtual

Called during the UpdateFirst on the parent Entity.

Reimplemented from Otter.Component.

Member Data Documentation

bool Otter.Controller.Enabled = true

Determines if the controller is enabled. If not, all buttons return false, and all axes return 0, 0.

List<int> Otter.Controller.JoystickIds = new List<int>()

The joystick id associated with this controller.

bool Otter.Controller.RecordAxes = true

If the controller should record axes data.

Property Documentation

string Otter.Controller.LastRecordedString
get

The last recorded data as a compressed string.

bool Otter.Controller.Playing
getset

If the controller is currently playing input data.

bool Otter.Controller.Recording
getset

If the controller is currently recording input.


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