Drag[en]gine Script Module DragonScript  1.21
Dragengine.InputDeviceAxis Class Reference

Input device axis. More...

Inheritance diagram for Dragengine.InputDeviceAxis:

Public Member Functions

Management
InputDevice getInputDevice ()
 Owner input device. More...
 
int getAxisIndex ()
 Axis index. More...
 
Axiss
String getID ()
 Axis identifier. More...
 
String getName ()
 Display name. More...
 
InputDeviceAxisType getType ()
 Axis type. More...
 
String getComponent ()
 Identifier of component or empty string if standalone. More...
 
Image getDisplayImage ()
 Image to represent the axis in 2D user interfaces or NULL if not set. More...
 
int getDisplayIconCount ()
 Count of icons representing the axis in bindings. More...
 
Image getDisplayIconAt (int index)
 Icon at index representing the axis in bindings. More...
 
Image getLargestDisplayIconX (int maxWidth)
 Largest icon not exceeding width representing the device in bindings. More...
 
Image getLargestDisplayIconY (int maxHeight)
 Largest icon not exceeding height representing the device in bindings. More...
 
String getDisplayText ()
 Text to display centered across display image or icon. More...
 
float getValue ()
 Get current value. More...
 

Detailed Description

Input device axis.

Wraps a input device axis by axis index.

Axes can be any input control a user can alter between a minimum and maximum range. Axes are always a single value. Input elements moving along more than 1 degree of freedom one individual axis is used for each degree of freedom. A mouse has 2 axes one for X movement and one for Y movement. The same applies to an analog stick on a joystick or gamepad. A 3D mouse or joystick with twist support use 3 axes. Complex input controls like racing wheels can have more than 3 axes.

Dead zone and jitter is handled by the input module. The scripting module does not have to worry about this. The input module adjusts the values to hide these parameters. For example for a gamepad the input value is mapped from the range (realMinimum -> deadZone) to (-1, 0) and (deadZone -> realMaximum) to (0, 1). The entire dead zone shows up as 0 value to the scripting module no matter how the user configurated the dead zone.

The minimum, center and maximum values are fixed to -1, 0 and 1. The input module maps the axis range to this value range to simplify the use for script modules. The input handling used by scripts has to matcht the way axes work. A stick matches the -1 to 1 range with 0 value if the stick is not touched. A throttle control on the other hand can have the center position at the minimum position. In this case the game script has to map -1 to 0 to get the correct result. The user is responsible to assign the matching input axes to the appropriate game bindings. The game can use the device type to locate potential problems due to misconfiguration. Relative axes work different in that they have no limited range. The returned value is always the last change in position reported which can be larger than 1.

This is a native class.

Member Function Documentation

◆ getAxisIndex()

int Dragengine.InputDeviceAxis.getAxisIndex ( )

Axis index.

◆ getComponent()

String Dragengine.InputDeviceAxis.getComponent ( )

Identifier of component or empty string if standalone.

Version
1.6

◆ getDisplayIconAt()

Image Dragengine.InputDeviceAxis.getDisplayIconAt ( int  index)

Icon at index representing the axis in bindings.

Icon typically has a size of 16, 24, 32 or 64.

◆ getDisplayIconCount()

int Dragengine.InputDeviceAxis.getDisplayIconCount ( )

Count of icons representing the axis in bindings.

◆ getDisplayImage()

Image Dragengine.InputDeviceAxis.getDisplayImage ( )

Image to represent the axis in 2D user interfaces or NULL if not set.

Large image of 128 pixels squared or larger.

◆ getDisplayText()

String Dragengine.InputDeviceAxis.getDisplayText ( )

Text to display centered across display image or icon.

◆ getID()

String Dragengine.InputDeviceAxis.getID ( )

Axis identifier.

Unique identifier for the axis identifying it inside the parent device. The prefix is a normalized string that contains only letters, numbers and underscores. It is suitable to be combined with the device identifier to store them in config files as key bindings.

◆ getInputDevice()

InputDevice Dragengine.InputDeviceAxis.getInputDevice ( )

Owner input device.

◆ getLargestDisplayIconX()

Image Dragengine.InputDeviceAxis.getLargestDisplayIconX ( int  maxWidth)

Largest icon not exceeding width representing the device in bindings.

Icon typically has a size of 16, 24, 32 or 64.

◆ getLargestDisplayIconY()

Image Dragengine.InputDeviceAxis.getLargestDisplayIconY ( int  maxHeight)

Largest icon not exceeding height representing the device in bindings.

Icon typically has a size of 16, 24, 32 or 64.

◆ getName()

String Dragengine.InputDeviceAxis.getName ( )

Display name.

Dispaly name is human readable like for example 'Axis #1'. The name is unique but not guaranteed to stay the same across restarting the input module or game engine.

◆ getType()

InputDeviceAxisType Dragengine.InputDeviceAxis.getType ( )

Axis type.

◆ getValue()

float Dragengine.InputDeviceAxis.getValue ( )

Get current value.

This obtains the current value from the input module. If the device has been detached from the host platform in the mean time 0 is returned. In contrary to InputSystem.getAxisValue() no exception is thrown. This allows to keep a reference to this instance without worrying about the device being detached from the system. If reattached the device properly works again.


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