Joystick Subsystem API Documentation
Device Handling
After you have created an instance of EM_JOYSTICK you have now full control of your joystick.
Basically they are two levels of controls. One level is on system scale and the other one is on device scale.
Handling on System Scale
To access all features on system scale you need to inherit from EM_SHARED_SUBSYSTEMS where you will find a singleton called joystick_subsystem. This singleton is an instance of EM_JOYSTICK_SUBSYSTEM with some features to get more information about all CD-Rom devices of your system.
E.g.: You can get the name of a device or count how many devices they are connected to your system.
Note: Those Information are updated during runtime, therefore they can change.
Handling on Device Scale
To access all features on device scale you need to create an instance of EM_JOYSTICK as mentioned above. This class will give you features to handle any Joystick's and to get information the current joystick state.
Note: Getting your information directly from a joystick device is very slow. It is much better to use joystick events, which contains information about every desired state changes. See below for more information.
Here is a list of all avaiable status information directly from your joystick:
If you want to get information about a joystick property, there are following features:
To view all features click here: EM_JOYSTICK
Joystick Events
As mentioned above, all state changes triggers an event. To catch an event simply subscribe to the desired event
from the event loop or redefine one of the predefined events from EM_SCENE
or one of its descendents.
Here is a list of all possibilities:
-
Predefined in EM_SCENE: handle_joystick_button_down_event
Subcribed from: joystick_button_down_event
Argument: EM_JOYSTICK_BUTTON_EVENT
Triggered: When a button is pressed. -
Predefined in EM_SCENE: handle_joystickup_down_event
Subcribed from: joystick_up_down_event
Argument: EM_JOYSTICK_BUTTON_EVENT
Triggered: When a button is released. -
Predefined in EM_SCENE: handle_joystick_hat_event
Subcribed from: joystick_hat_event
Argument: EM_JOYSTICK_HAT_EVENT
Triggered: When a hat is moved. -
Predefined in EM_SCENE: handle_joystick_ball_event
Subcribed from: joystick_ball_event
Argument: EM_JOYSTICK_BALL_EVENT
Triggered: When a ball is moved. -
Predefined in EM_SCENE: handle_joystick_axis_event
Subcribed from: joystick_axis_event
Argument: EM_JOYSTICK_AXIS_EVENT
Triggered: When an axis is moved.