System Event

This is the sub event that will be triggered by any system level event like adding or removing a gamepad.

This event can only be triggered by a system level event (currently the only event detected is the addition and removal of gamepads, but more shall be added) and it will return a ds_map stored in the variable async_load, containing different key/value pairs depending on the system level event that triggered the call-back.

Gamepads

When this event is triggered for a gamepad being connected or disconnected it will return one of the following key/value pairs in the async_load map:

  1. "event_type" - the type of system event received, which will be one of the following strings:
    • "gamepad discovered" - happens when the system reports a new gamepad has been connected
    • "gamepad lost" - happens when the system has lost connection to a gamepad
  2. "pad_index" - the index of the pad that has been added or removed

This event now permits you to move all your gamepad checking logic from the Step Event or an Alarm event into the System Event and only run it when it's actually required.

NOTE: The variable async_load is only valid in the asynchronous events, as the ds_map that is points to is created at the start of the event, then deleted again at the end, with this variable being reset to a value of -1. However, all further data-structures created from the event must be cleaned up using the appropriate functions.


Back: More About Async Events
Next: Image Loaded Event
© Copyright YoYo Games Ltd. 2018 All Rights Reserved