Unigine.Input Class
The Input class contains functions for simple manual handling of user inputs using a keyboard, a mouse or a gamepad.
This class represents an engine's singleton.
See Also#
- Input sample in C# Component Samples suite
Usage Examples#
The following example shows a way to move and rotate a node by using the Input class:
private Node box = null;
private const float moveSpeed = 1.0f;
private const float turnSpeed = 30.0f;
private void Init()
{
box = Primitives.CreateBox(vec3.ONE);
}
private void Update()
{
if (Unigine.Console.Active)
return;
if (Input.IsKeyPressed(Input.KEY.UP) || Input.IsKeyPressed(Input.KEY.W))
box.Translate(vec3.FORWARD * moveSpeed * Game.IFps);
if (Input.IsKeyPressed(Input.KEY.DOWN) || Input.IsKeyPressed(Input.KEY.S))
box.Translate(vec3.BACK * moveSpeed * Game.IFps);
if (Input.IsKeyPressed(Input.KEY.LEFT) || Input.IsKeyPressed(Input.KEY.A))
box.Rotate(0.0f, 0.0f, turnSpeed * Game.IFps);
if (Input.IsKeyPressed(Input.KEY.RIGHT) || Input.IsKeyPressed(Input.KEY.D))
box.Rotate(0.0f, 0.0f, -turnSpeed * Game.IFps);
}
The following code demonstrates how to receive an event that changed the button state to IsKeyDown, IsKeyUp. Such code can also be used for the mouse and touch buttons.
private void Update()
{
if (Input.IsKeyDown(Input.KEY.T) || Input.IsKeyUp(Input.KEY.T))
{
InputEventKeyboard e = Input.GetKeyEvent(Input.KEY.T);
Unigine.Console.MessageLine($"{Input.GetKeyName(e.Key)} {e.Action} time = {e.Timestamp} frame = {e.Frame}");
}
}
The following code illustrates receiving the immediate input — the user receives the event notification immediately after filtering:
private void Init()
{
Input.EventImmediateInput.Connect(OnImmediateInput);
}
private void OnImmediateInput(InputEvent e)
{
switch (e.Type)
{
case InputEvent.TYPE.INPUT_EVENT_KEYBOARD:
{
InputEventKeyboard k = e as InputEventKeyboard;
Unigine.Console.MessageLine($"keyboard event: {Input.GetKeyName(k.Key)} {k.Action}");
break;
}
case InputEvent.TYPE.INPUT_EVENT_MOUSE_BUTTON:
{
InputEventMouseButton m = e as InputEventMouseButton;
Unigine.Console.MessageLine($"mouse button event: {Input.GetMouseButtonName(m.Button)} {m.Action}");
break;
}
default: break;
}
}
The following code illustrates how the event filter works. Pressing the "W" button and mouse movements will be declined, i.e. these events won't be taken as input:
private void Init()
{
Input.SetEventsFilter(EventFilter);
}
private int EventFilter(InputEvent e)
{
switch (e.Type)
{
case InputEvent.TYPE.INPUT_EVENT_KEYBOARD:
{
// skip 'W' key repeat events
InputEventKeyboard k = e as InputEventKeyboard;
if (k.Key == Input.KEY.W && k.Action == InputEventKeyboard.ACTION.REPEAT)
return 1;
break;
}
case InputEvent.TYPE.INPUT_EVENT_MOUSE_MOTION:
{
// skip all mouse motion events
return 1;
}
default: break;
}
return 0;
}
The following code is an example of input events creation. We'll imitate the input of the show_profiler 1 console command as if it were an event from the keyboard.
enum STATE
{
OPEN_CONSOLE = 0,
TYPING_COMMAND,
APPLY_COMMAND,
FINISH,
}
private STATE state = STATE.OPEN_CONSOLE;
void emulate_key_input(Input.KEY key)
{
InputEventKeyboard key_down = new InputEventKeyboard();
key_down.Action = InputEventKeyboard.ACTION.DOWN;
key_down.Key = key;
InputEventKeyboard key_repeat = new InputEventKeyboard();
key_repeat.Action = InputEventKeyboard.ACTION.REPEAT;
key_repeat.Key = key;
InputEventKeyboard key_up = new InputEventKeyboard();
key_up.Action = InputEventKeyboard.ACTION.UP;
key_up.Key = key;
Input.SendEvent(key_down);
Input.SendEvent(key_repeat);
Input.SendEvent(key_up);
}
void emulate_text_input(String text)
{
int size = text.Length;
for (int i = 0; i < size; i++)
{
InputEventText text_input = new InputEventText();
text_input.Unicode = text[i];
Input.SendEvent(text_input);
}
}
private void Update()
{
switch (state)
{
case STATE.OPEN_CONSOLE:
{
emulate_key_input(Input.KEY.BACK_QUOTE);
state = STATE.TYPING_COMMAND;
break;
}
case STATE.TYPING_COMMAND:
{
emulate_text_input("show_profiler 1");
state = STATE.APPLY_COMMAND;
break;
}
case STATE.APPLY_COMMAND:
{
emulate_key_input(Input.KEY.ENTER);
state = STATE.FINISH;
break;
}
default: break;
}
}
The following code demonstrates how to obtain various button names using the GetKeyName(), KeyToUnicode(), and GetKeyLocalName() methods:
/*...*/
using System.Linq;
using System.Text;
/*...*/
private void Init()
{
Unigine.Console.Onscreen = true;
}
private void Update()
{
var printInfo = (string state, Input.KEY key) =>
{
uint unicode = Input.KeyToUnicode(key);
string unicodeName = Encoding.Unicode.GetString(BitConverter.GetBytes(unicode));
unicodeName = unicodeName.TrimEnd('\0');
Unigine.Console.Message($"{state}: (key='{Input.GetKeyName(key)}', unicode='{unicodeName}', local_name='{Input.GetKeyLocalName(key)}') ");
};
printInfo("Up", Input.KEY.W);
printInfo("Jump", Input.KEY.SPACE);
printInfo("Run", Input.KEY.RIGHT_SHIFT);
Unigine.Console.Message("\n");
}
Input Class
Enums
MOUSE_HANDLE#
MOUSE_BUTTON#
MODIFIER#
KEY#
DEVICE#
GAMEPAD_BUTTON#
Buttons of the gamepad.GAMEPAD_AXIS#
JOYSTICK_POV#
POV (Point-of-View) switch or DPad states.VR_BUTTON#
JOYSTICK_FORCE_FEEDBACK_EFFECT#
Properties
int NumJoysticks#
int NumGamePads#
int MouseWheelHorizontal#
int MouseWheel#
ivec2 MouseDeltaPosition#
ivec2 MousePosition#
Input.MOUSE_HANDLE MouseHandle#
bool MouseCursorNeedUpdate#
bool MouseCursorSystem#
bool MouseCursorHide#
bool MouseGrab#
string Clipboard#
bool IsEmptyClipboard#
ivec2 MouseDeltaRaw#
InputVRController VRControllerTreadmill#
InputVRController VRControllerRight#
InputVRController VRControllerLeft#
InputVRHead VRHead#
int NumVRDevices#
Event<InputEvent> EventImmediateInput#
Usage Example
// implement the ImmediateInput event handler
void immediateinput_event_handler(InputEvent event)
{
Log.Message("\Handling ImmediateInput event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections immediateinput_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventImmediateInput.Connect(immediateinput_event_connections, immediateinput_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventImmediateInput.Connect(immediateinput_event_connections, (InputEvent event) => {
Log.Message("Handling ImmediateInput event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
immediateinput_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the ImmediateInput event with a handler function
Input.EventImmediateInput.Connect(immediateinput_event_handler);
// remove subscription to the ImmediateInput event later by the handler function
Input.EventImmediateInput.Disconnect(immediateinput_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection immediateinput_event_connection;
// subscribe to the ImmediateInput event with a lambda handler function and keeping the connection
immediateinput_event_connection = Input.EventImmediateInput.Connect((InputEvent event) => {
Log.Message("Handling ImmediateInput event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
immediateinput_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
immediateinput_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
immediateinput_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring ImmediateInput events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventImmediateInput.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventImmediateInput.Enabled = true;
Event<int, int> EventJoyPovMotion#
Usage Example
// implement the JoyPovMotion event handler
void joypovmotion_event_handler(int joystick_id, int pov_index)
{
Log.Message("\Handling JoyPovMotion event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections joypovmotion_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventJoyPovMotion.Connect(joypovmotion_event_connections, joypovmotion_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventJoyPovMotion.Connect(joypovmotion_event_connections, (int joystick_id, int pov_index) => {
Log.Message("Handling JoyPovMotion event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
joypovmotion_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the JoyPovMotion event with a handler function
Input.EventJoyPovMotion.Connect(joypovmotion_event_handler);
// remove subscription to the JoyPovMotion event later by the handler function
Input.EventJoyPovMotion.Disconnect(joypovmotion_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection joypovmotion_event_connection;
// subscribe to the JoyPovMotion event with a lambda handler function and keeping the connection
joypovmotion_event_connection = Input.EventJoyPovMotion.Connect((int joystick_id, int pov_index) => {
Log.Message("Handling JoyPovMotion event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
joypovmotion_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
joypovmotion_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
joypovmotion_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring JoyPovMotion events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventJoyPovMotion.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventJoyPovMotion.Enabled = true;
Event<int, int> EventJoyAxisMotion#
Usage Example
// implement the JoyAxisMotion event handler
void joyaxismotion_event_handler(int joystick_id, int axis)
{
Log.Message("\Handling JoyAxisMotion event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections joyaxismotion_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventJoyAxisMotion.Connect(joyaxismotion_event_connections, joyaxismotion_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventJoyAxisMotion.Connect(joyaxismotion_event_connections, (int joystick_id, int axis) => {
Log.Message("Handling JoyAxisMotion event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
joyaxismotion_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the JoyAxisMotion event with a handler function
Input.EventJoyAxisMotion.Connect(joyaxismotion_event_handler);
// remove subscription to the JoyAxisMotion event later by the handler function
Input.EventJoyAxisMotion.Disconnect(joyaxismotion_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection joyaxismotion_event_connection;
// subscribe to the JoyAxisMotion event with a lambda handler function and keeping the connection
joyaxismotion_event_connection = Input.EventJoyAxisMotion.Connect((int joystick_id, int axis) => {
Log.Message("Handling JoyAxisMotion event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
joyaxismotion_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
joyaxismotion_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
joyaxismotion_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring JoyAxisMotion events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventJoyAxisMotion.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventJoyAxisMotion.Enabled = true;
Event<int, int> EventJoyButtonUp#
Usage Example
// implement the JoyButtonUp event handler
void joybuttonup_event_handler(int joystick_id, int button)
{
Log.Message("\Handling JoyButtonUp event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections joybuttonup_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventJoyButtonUp.Connect(joybuttonup_event_connections, joybuttonup_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventJoyButtonUp.Connect(joybuttonup_event_connections, (int joystick_id, int button) => {
Log.Message("Handling JoyButtonUp event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
joybuttonup_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the JoyButtonUp event with a handler function
Input.EventJoyButtonUp.Connect(joybuttonup_event_handler);
// remove subscription to the JoyButtonUp event later by the handler function
Input.EventJoyButtonUp.Disconnect(joybuttonup_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection joybuttonup_event_connection;
// subscribe to the JoyButtonUp event with a lambda handler function and keeping the connection
joybuttonup_event_connection = Input.EventJoyButtonUp.Connect((int joystick_id, int button) => {
Log.Message("Handling JoyButtonUp event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
joybuttonup_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
joybuttonup_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
joybuttonup_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring JoyButtonUp events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventJoyButtonUp.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventJoyButtonUp.Enabled = true;
Event<int, int> EventJoyButtonDown#
Usage Example
// implement the JoyButtonDown event handler
void joybuttondown_event_handler(int joystick_id, int button)
{
Log.Message("\Handling JoyButtonDown event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections joybuttondown_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventJoyButtonDown.Connect(joybuttondown_event_connections, joybuttondown_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventJoyButtonDown.Connect(joybuttondown_event_connections, (int joystick_id, int button) => {
Log.Message("Handling JoyButtonDown event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
joybuttondown_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the JoyButtonDown event with a handler function
Input.EventJoyButtonDown.Connect(joybuttondown_event_handler);
// remove subscription to the JoyButtonDown event later by the handler function
Input.EventJoyButtonDown.Disconnect(joybuttondown_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection joybuttondown_event_connection;
// subscribe to the JoyButtonDown event with a lambda handler function and keeping the connection
joybuttondown_event_connection = Input.EventJoyButtonDown.Connect((int joystick_id, int button) => {
Log.Message("Handling JoyButtonDown event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
joybuttondown_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
joybuttondown_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
joybuttondown_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring JoyButtonDown events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventJoyButtonDown.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventJoyButtonDown.Enabled = true;
Event<int> EventJoyDisconnected#
Usage Example
// implement the JoyDisconnected event handler
void joydisconnected_event_handler(int joystick_id)
{
Log.Message("\Handling JoyDisconnected event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections joydisconnected_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventJoyDisconnected.Connect(joydisconnected_event_connections, joydisconnected_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventJoyDisconnected.Connect(joydisconnected_event_connections, (int joystick_id) => {
Log.Message("Handling JoyDisconnected event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
joydisconnected_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the JoyDisconnected event with a handler function
Input.EventJoyDisconnected.Connect(joydisconnected_event_handler);
// remove subscription to the JoyDisconnected event later by the handler function
Input.EventJoyDisconnected.Disconnect(joydisconnected_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection joydisconnected_event_connection;
// subscribe to the JoyDisconnected event with a lambda handler function and keeping the connection
joydisconnected_event_connection = Input.EventJoyDisconnected.Connect((int joystick_id) => {
Log.Message("Handling JoyDisconnected event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
joydisconnected_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
joydisconnected_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
joydisconnected_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring JoyDisconnected events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventJoyDisconnected.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventJoyDisconnected.Enabled = true;
Event<int> EventJoyConnected#
Usage Example
// implement the JoyConnected event handler
void joyconnected_event_handler(int joystick_id)
{
Log.Message("\Handling JoyConnected event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections joyconnected_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventJoyConnected.Connect(joyconnected_event_connections, joyconnected_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventJoyConnected.Connect(joyconnected_event_connections, (int joystick_id) => {
Log.Message("Handling JoyConnected event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
joyconnected_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the JoyConnected event with a handler function
Input.EventJoyConnected.Connect(joyconnected_event_handler);
// remove subscription to the JoyConnected event later by the handler function
Input.EventJoyConnected.Disconnect(joyconnected_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection joyconnected_event_connection;
// subscribe to the JoyConnected event with a lambda handler function and keeping the connection
joyconnected_event_connection = Input.EventJoyConnected.Connect((int joystick_id) => {
Log.Message("Handling JoyConnected event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
joyconnected_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
joyconnected_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
joyconnected_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring JoyConnected events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventJoyConnected.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventJoyConnected.Enabled = true;
Event<int, int> EventVrDeviceAxisMotion#
Usage Example
// implement the VrDeviceAxisMotion event handler
void vrdeviceaxismotion_event_handler(int device_id, int axis)
{
Log.Message("\Handling VrDeviceAxisMotion event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections vrdeviceaxismotion_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventVrDeviceAxisMotion.Connect(vrdeviceaxismotion_event_connections, vrdeviceaxismotion_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventVrDeviceAxisMotion.Connect(vrdeviceaxismotion_event_connections, (int device_id, int axis) => {
Log.Message("Handling VrDeviceAxisMotion event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
vrdeviceaxismotion_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the VrDeviceAxisMotion event with a handler function
Input.EventVrDeviceAxisMotion.Connect(vrdeviceaxismotion_event_handler);
// remove subscription to the VrDeviceAxisMotion event later by the handler function
Input.EventVrDeviceAxisMotion.Disconnect(vrdeviceaxismotion_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection vrdeviceaxismotion_event_connection;
// subscribe to the VrDeviceAxisMotion event with a lambda handler function and keeping the connection
vrdeviceaxismotion_event_connection = Input.EventVrDeviceAxisMotion.Connect((int device_id, int axis) => {
Log.Message("Handling VrDeviceAxisMotion event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
vrdeviceaxismotion_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
vrdeviceaxismotion_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
vrdeviceaxismotion_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring VrDeviceAxisMotion events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventVrDeviceAxisMotion.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventVrDeviceAxisMotion.Enabled = true;
Event<int, Input.VR_BUTTON> EventVrDeviceButtonTouchUp#
Usage Example
// implement the VrDeviceButtonTouchUp event handler
void vrdevicebuttontouchup_event_handler(int device_id, Input.VR_BUTTON button)
{
Log.Message("\Handling VrDeviceButtonTouchUp event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections vrdevicebuttontouchup_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventVrDeviceButtonTouchUp.Connect(vrdevicebuttontouchup_event_connections, vrdevicebuttontouchup_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventVrDeviceButtonTouchUp.Connect(vrdevicebuttontouchup_event_connections, (int device_id, Input.VR_BUTTON button) => {
Log.Message("Handling VrDeviceButtonTouchUp event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
vrdevicebuttontouchup_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the VrDeviceButtonTouchUp event with a handler function
Input.EventVrDeviceButtonTouchUp.Connect(vrdevicebuttontouchup_event_handler);
// remove subscription to the VrDeviceButtonTouchUp event later by the handler function
Input.EventVrDeviceButtonTouchUp.Disconnect(vrdevicebuttontouchup_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection vrdevicebuttontouchup_event_connection;
// subscribe to the VrDeviceButtonTouchUp event with a lambda handler function and keeping the connection
vrdevicebuttontouchup_event_connection = Input.EventVrDeviceButtonTouchUp.Connect((int device_id, Input.VR_BUTTON button) => {
Log.Message("Handling VrDeviceButtonTouchUp event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
vrdevicebuttontouchup_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
vrdevicebuttontouchup_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
vrdevicebuttontouchup_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring VrDeviceButtonTouchUp events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventVrDeviceButtonTouchUp.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventVrDeviceButtonTouchUp.Enabled = true;
Event<int, Input.VR_BUTTON> EventVrDeviceButtonTouchDown#
Usage Example
// implement the VrDeviceButtonTouchDown event handler
void vrdevicebuttontouchdown_event_handler(int device_id, Input.VR_BUTTON button)
{
Log.Message("\Handling VrDeviceButtonTouchDown event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections vrdevicebuttontouchdown_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventVrDeviceButtonTouchDown.Connect(vrdevicebuttontouchdown_event_connections, vrdevicebuttontouchdown_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventVrDeviceButtonTouchDown.Connect(vrdevicebuttontouchdown_event_connections, (int device_id, Input.VR_BUTTON button) => {
Log.Message("Handling VrDeviceButtonTouchDown event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
vrdevicebuttontouchdown_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the VrDeviceButtonTouchDown event with a handler function
Input.EventVrDeviceButtonTouchDown.Connect(vrdevicebuttontouchdown_event_handler);
// remove subscription to the VrDeviceButtonTouchDown event later by the handler function
Input.EventVrDeviceButtonTouchDown.Disconnect(vrdevicebuttontouchdown_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection vrdevicebuttontouchdown_event_connection;
// subscribe to the VrDeviceButtonTouchDown event with a lambda handler function and keeping the connection
vrdevicebuttontouchdown_event_connection = Input.EventVrDeviceButtonTouchDown.Connect((int device_id, Input.VR_BUTTON button) => {
Log.Message("Handling VrDeviceButtonTouchDown event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
vrdevicebuttontouchdown_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
vrdevicebuttontouchdown_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
vrdevicebuttontouchdown_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring VrDeviceButtonTouchDown events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventVrDeviceButtonTouchDown.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventVrDeviceButtonTouchDown.Enabled = true;
Event<int, Input.VR_BUTTON> EventVrDeviceButtonUp#
Usage Example
// implement the VrDeviceButtonUp event handler
void vrdevicebuttonup_event_handler(int device_id, Input.VR_BUTTON button)
{
Log.Message("\Handling VrDeviceButtonUp event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections vrdevicebuttonup_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventVrDeviceButtonUp.Connect(vrdevicebuttonup_event_connections, vrdevicebuttonup_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventVrDeviceButtonUp.Connect(vrdevicebuttonup_event_connections, (int device_id, Input.VR_BUTTON button) => {
Log.Message("Handling VrDeviceButtonUp event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
vrdevicebuttonup_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the VrDeviceButtonUp event with a handler function
Input.EventVrDeviceButtonUp.Connect(vrdevicebuttonup_event_handler);
// remove subscription to the VrDeviceButtonUp event later by the handler function
Input.EventVrDeviceButtonUp.Disconnect(vrdevicebuttonup_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection vrdevicebuttonup_event_connection;
// subscribe to the VrDeviceButtonUp event with a lambda handler function and keeping the connection
vrdevicebuttonup_event_connection = Input.EventVrDeviceButtonUp.Connect((int device_id, Input.VR_BUTTON button) => {
Log.Message("Handling VrDeviceButtonUp event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
vrdevicebuttonup_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
vrdevicebuttonup_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
vrdevicebuttonup_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring VrDeviceButtonUp events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventVrDeviceButtonUp.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventVrDeviceButtonUp.Enabled = true;
Event<int, Input.VR_BUTTON> EventVrDeviceButtonDown#
Usage Example
// implement the VrDeviceButtonDown event handler
void vrdevicebuttondown_event_handler(int device_id, Input.VR_BUTTON button)
{
Log.Message("\Handling VrDeviceButtonDown event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections vrdevicebuttondown_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventVrDeviceButtonDown.Connect(vrdevicebuttondown_event_connections, vrdevicebuttondown_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventVrDeviceButtonDown.Connect(vrdevicebuttondown_event_connections, (int device_id, Input.VR_BUTTON button) => {
Log.Message("Handling VrDeviceButtonDown event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
vrdevicebuttondown_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the VrDeviceButtonDown event with a handler function
Input.EventVrDeviceButtonDown.Connect(vrdevicebuttondown_event_handler);
// remove subscription to the VrDeviceButtonDown event later by the handler function
Input.EventVrDeviceButtonDown.Disconnect(vrdevicebuttondown_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection vrdevicebuttondown_event_connection;
// subscribe to the VrDeviceButtonDown event with a lambda handler function and keeping the connection
vrdevicebuttondown_event_connection = Input.EventVrDeviceButtonDown.Connect((int device_id, Input.VR_BUTTON button) => {
Log.Message("Handling VrDeviceButtonDown event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
vrdevicebuttondown_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
vrdevicebuttondown_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
vrdevicebuttondown_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring VrDeviceButtonDown events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventVrDeviceButtonDown.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventVrDeviceButtonDown.Enabled = true;
Event<int> EventVrDeviceDisconnected#
Usage Example
// implement the VrDeviceDisconnected event handler
void vrdevicedisconnected_event_handler(int device_id)
{
Log.Message("\Handling VrDeviceDisconnected event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections vrdevicedisconnected_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventVrDeviceDisconnected.Connect(vrdevicedisconnected_event_connections, vrdevicedisconnected_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventVrDeviceDisconnected.Connect(vrdevicedisconnected_event_connections, (int device_id) => {
Log.Message("Handling VrDeviceDisconnected event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
vrdevicedisconnected_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the VrDeviceDisconnected event with a handler function
Input.EventVrDeviceDisconnected.Connect(vrdevicedisconnected_event_handler);
// remove subscription to the VrDeviceDisconnected event later by the handler function
Input.EventVrDeviceDisconnected.Disconnect(vrdevicedisconnected_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection vrdevicedisconnected_event_connection;
// subscribe to the VrDeviceDisconnected event with a lambda handler function and keeping the connection
vrdevicedisconnected_event_connection = Input.EventVrDeviceDisconnected.Connect((int device_id) => {
Log.Message("Handling VrDeviceDisconnected event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
vrdevicedisconnected_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
vrdevicedisconnected_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
vrdevicedisconnected_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring VrDeviceDisconnected events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventVrDeviceDisconnected.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventVrDeviceDisconnected.Enabled = true;
Event<int> EventVrDeviceConnected#
Usage Example
// implement the VrDeviceConnected event handler
void vrdeviceconnected_event_handler(int device_id)
{
Log.Message("\Handling VrDeviceConnected event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections vrdeviceconnected_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventVrDeviceConnected.Connect(vrdeviceconnected_event_connections, vrdeviceconnected_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventVrDeviceConnected.Connect(vrdeviceconnected_event_connections, (int device_id) => {
Log.Message("Handling VrDeviceConnected event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
vrdeviceconnected_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the VrDeviceConnected event with a handler function
Input.EventVrDeviceConnected.Connect(vrdeviceconnected_event_handler);
// remove subscription to the VrDeviceConnected event later by the handler function
Input.EventVrDeviceConnected.Disconnect(vrdeviceconnected_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection vrdeviceconnected_event_connection;
// subscribe to the VrDeviceConnected event with a lambda handler function and keeping the connection
vrdeviceconnected_event_connection = Input.EventVrDeviceConnected.Connect((int device_id) => {
Log.Message("Handling VrDeviceConnected event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
vrdeviceconnected_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
vrdeviceconnected_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
vrdeviceconnected_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring VrDeviceConnected events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventVrDeviceConnected.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventVrDeviceConnected.Enabled = true;
Event<int, int, int> EventGamepadTouchMotion#
Usage Example
// implement the GamepadTouchMotion event handler
void gamepadtouchmotion_event_handler(int gamepad_id, int touch_id, int finger)
{
Log.Message("\Handling GamepadTouchMotion event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections gamepadtouchmotion_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventGamepadTouchMotion.Connect(gamepadtouchmotion_event_connections, gamepadtouchmotion_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventGamepadTouchMotion.Connect(gamepadtouchmotion_event_connections, (int gamepad_id, int touch_id, int finger) => {
Log.Message("Handling GamepadTouchMotion event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
gamepadtouchmotion_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the GamepadTouchMotion event with a handler function
Input.EventGamepadTouchMotion.Connect(gamepadtouchmotion_event_handler);
// remove subscription to the GamepadTouchMotion event later by the handler function
Input.EventGamepadTouchMotion.Disconnect(gamepadtouchmotion_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection gamepadtouchmotion_event_connection;
// subscribe to the GamepadTouchMotion event with a lambda handler function and keeping the connection
gamepadtouchmotion_event_connection = Input.EventGamepadTouchMotion.Connect((int gamepad_id, int touch_id, int finger) => {
Log.Message("Handling GamepadTouchMotion event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
gamepadtouchmotion_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
gamepadtouchmotion_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
gamepadtouchmotion_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring GamepadTouchMotion events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventGamepadTouchMotion.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventGamepadTouchMotion.Enabled = true;
Event<int, int, int> EventGamepadTouchUp#
Usage Example
// implement the GamepadTouchUp event handler
void gamepadtouchup_event_handler(int gamepad_id, int touch_id, int finger)
{
Log.Message("\Handling GamepadTouchUp event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections gamepadtouchup_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventGamepadTouchUp.Connect(gamepadtouchup_event_connections, gamepadtouchup_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventGamepadTouchUp.Connect(gamepadtouchup_event_connections, (int gamepad_id, int touch_id, int finger) => {
Log.Message("Handling GamepadTouchUp event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
gamepadtouchup_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the GamepadTouchUp event with a handler function
Input.EventGamepadTouchUp.Connect(gamepadtouchup_event_handler);
// remove subscription to the GamepadTouchUp event later by the handler function
Input.EventGamepadTouchUp.Disconnect(gamepadtouchup_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection gamepadtouchup_event_connection;
// subscribe to the GamepadTouchUp event with a lambda handler function and keeping the connection
gamepadtouchup_event_connection = Input.EventGamepadTouchUp.Connect((int gamepad_id, int touch_id, int finger) => {
Log.Message("Handling GamepadTouchUp event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
gamepadtouchup_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
gamepadtouchup_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
gamepadtouchup_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring GamepadTouchUp events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventGamepadTouchUp.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventGamepadTouchUp.Enabled = true;
Event<int, int, int> EventGamepadTouchDown#
Usage Example
// implement the GamepadTouchDown event handler
void gamepadtouchdown_event_handler(int gamepad_id, int touch_id, int finger)
{
Log.Message("\Handling GamepadTouchDown event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections gamepadtouchdown_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventGamepadTouchDown.Connect(gamepadtouchdown_event_connections, gamepadtouchdown_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventGamepadTouchDown.Connect(gamepadtouchdown_event_connections, (int gamepad_id, int touch_id, int finger) => {
Log.Message("Handling GamepadTouchDown event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
gamepadtouchdown_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the GamepadTouchDown event with a handler function
Input.EventGamepadTouchDown.Connect(gamepadtouchdown_event_handler);
// remove subscription to the GamepadTouchDown event later by the handler function
Input.EventGamepadTouchDown.Disconnect(gamepadtouchdown_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection gamepadtouchdown_event_connection;
// subscribe to the GamepadTouchDown event with a lambda handler function and keeping the connection
gamepadtouchdown_event_connection = Input.EventGamepadTouchDown.Connect((int gamepad_id, int touch_id, int finger) => {
Log.Message("Handling GamepadTouchDown event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
gamepadtouchdown_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
gamepadtouchdown_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
gamepadtouchdown_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring GamepadTouchDown events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventGamepadTouchDown.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventGamepadTouchDown.Enabled = true;
Event<int, Input.GAMEPAD_AXIS> EventGamepadAxisMotion#
Usage Example
// implement the GamepadAxisMotion event handler
void gamepadaxismotion_event_handler(int gamepad_id, Input.GAMEPAD_AXIS axis)
{
Log.Message("\Handling GamepadAxisMotion event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections gamepadaxismotion_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventGamepadAxisMotion.Connect(gamepadaxismotion_event_connections, gamepadaxismotion_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventGamepadAxisMotion.Connect(gamepadaxismotion_event_connections, (int gamepad_id, Input.GAMEPAD_AXIS axis) => {
Log.Message("Handling GamepadAxisMotion event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
gamepadaxismotion_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the GamepadAxisMotion event with a handler function
Input.EventGamepadAxisMotion.Connect(gamepadaxismotion_event_handler);
// remove subscription to the GamepadAxisMotion event later by the handler function
Input.EventGamepadAxisMotion.Disconnect(gamepadaxismotion_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection gamepadaxismotion_event_connection;
// subscribe to the GamepadAxisMotion event with a lambda handler function and keeping the connection
gamepadaxismotion_event_connection = Input.EventGamepadAxisMotion.Connect((int gamepad_id, Input.GAMEPAD_AXIS axis) => {
Log.Message("Handling GamepadAxisMotion event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
gamepadaxismotion_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
gamepadaxismotion_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
gamepadaxismotion_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring GamepadAxisMotion events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventGamepadAxisMotion.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventGamepadAxisMotion.Enabled = true;
Event<int, Input.GAMEPAD_BUTTON> EventGamepadButtonUp#
Usage Example
// implement the GamepadButtonUp event handler
void gamepadbuttonup_event_handler(int gamepad_id, Input.GAMEPAD_BUTTON button)
{
Log.Message("\Handling GamepadButtonUp event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections gamepadbuttonup_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventGamepadButtonUp.Connect(gamepadbuttonup_event_connections, gamepadbuttonup_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventGamepadButtonUp.Connect(gamepadbuttonup_event_connections, (int gamepad_id, Input.GAMEPAD_BUTTON button) => {
Log.Message("Handling GamepadButtonUp event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
gamepadbuttonup_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the GamepadButtonUp event with a handler function
Input.EventGamepadButtonUp.Connect(gamepadbuttonup_event_handler);
// remove subscription to the GamepadButtonUp event later by the handler function
Input.EventGamepadButtonUp.Disconnect(gamepadbuttonup_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection gamepadbuttonup_event_connection;
// subscribe to the GamepadButtonUp event with a lambda handler function and keeping the connection
gamepadbuttonup_event_connection = Input.EventGamepadButtonUp.Connect((int gamepad_id, Input.GAMEPAD_BUTTON button) => {
Log.Message("Handling GamepadButtonUp event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
gamepadbuttonup_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
gamepadbuttonup_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
gamepadbuttonup_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring GamepadButtonUp events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventGamepadButtonUp.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventGamepadButtonUp.Enabled = true;
Event<int, Input.GAMEPAD_BUTTON> EventGamepadButtonDown#
Usage Example
// implement the GamepadButtonDown event handler
void gamepadbuttondown_event_handler(int gamepad_id, Input.GAMEPAD_BUTTON button)
{
Log.Message("\Handling GamepadButtonDown event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections gamepadbuttondown_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventGamepadButtonDown.Connect(gamepadbuttondown_event_connections, gamepadbuttondown_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventGamepadButtonDown.Connect(gamepadbuttondown_event_connections, (int gamepad_id, Input.GAMEPAD_BUTTON button) => {
Log.Message("Handling GamepadButtonDown event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
gamepadbuttondown_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the GamepadButtonDown event with a handler function
Input.EventGamepadButtonDown.Connect(gamepadbuttondown_event_handler);
// remove subscription to the GamepadButtonDown event later by the handler function
Input.EventGamepadButtonDown.Disconnect(gamepadbuttondown_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection gamepadbuttondown_event_connection;
// subscribe to the GamepadButtonDown event with a lambda handler function and keeping the connection
gamepadbuttondown_event_connection = Input.EventGamepadButtonDown.Connect((int gamepad_id, Input.GAMEPAD_BUTTON button) => {
Log.Message("Handling GamepadButtonDown event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
gamepadbuttondown_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
gamepadbuttondown_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
gamepadbuttondown_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring GamepadButtonDown events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventGamepadButtonDown.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventGamepadButtonDown.Enabled = true;
Event<int> EventGamepadDisconnected#
Usage Example
// implement the GamepadDisconnected event handler
void gamepaddisconnected_event_handler(int gamepad_id)
{
Log.Message("\Handling GamepadDisconnected event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections gamepaddisconnected_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventGamepadDisconnected.Connect(gamepaddisconnected_event_connections, gamepaddisconnected_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventGamepadDisconnected.Connect(gamepaddisconnected_event_connections, (int gamepad_id) => {
Log.Message("Handling GamepadDisconnected event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
gamepaddisconnected_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the GamepadDisconnected event with a handler function
Input.EventGamepadDisconnected.Connect(gamepaddisconnected_event_handler);
// remove subscription to the GamepadDisconnected event later by the handler function
Input.EventGamepadDisconnected.Disconnect(gamepaddisconnected_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection gamepaddisconnected_event_connection;
// subscribe to the GamepadDisconnected event with a lambda handler function and keeping the connection
gamepaddisconnected_event_connection = Input.EventGamepadDisconnected.Connect((int gamepad_id) => {
Log.Message("Handling GamepadDisconnected event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
gamepaddisconnected_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
gamepaddisconnected_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
gamepaddisconnected_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring GamepadDisconnected events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventGamepadDisconnected.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventGamepadDisconnected.Enabled = true;
Event<int> EventGamepadConnected#
Usage Example
// implement the GamepadConnected event handler
void gamepadconnected_event_handler(int gamepad_id)
{
Log.Message("\Handling GamepadConnected event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections gamepadconnected_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventGamepadConnected.Connect(gamepadconnected_event_connections, gamepadconnected_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventGamepadConnected.Connect(gamepadconnected_event_connections, (int gamepad_id) => {
Log.Message("Handling GamepadConnected event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
gamepadconnected_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the GamepadConnected event with a handler function
Input.EventGamepadConnected.Connect(gamepadconnected_event_handler);
// remove subscription to the GamepadConnected event later by the handler function
Input.EventGamepadConnected.Disconnect(gamepadconnected_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection gamepadconnected_event_connection;
// subscribe to the GamepadConnected event with a lambda handler function and keeping the connection
gamepadconnected_event_connection = Input.EventGamepadConnected.Connect((int gamepad_id) => {
Log.Message("Handling GamepadConnected event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
gamepadconnected_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
gamepadconnected_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
gamepadconnected_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring GamepadConnected events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventGamepadConnected.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventGamepadConnected.Enabled = true;
Event<int> EventTouchMotion#
Usage Example
// implement the TouchMotion event handler
void touchmotion_event_handler(int touch_id)
{
Log.Message("\Handling TouchMotion event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections touchmotion_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventTouchMotion.Connect(touchmotion_event_connections, touchmotion_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventTouchMotion.Connect(touchmotion_event_connections, (int touch_id) => {
Log.Message("Handling TouchMotion event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
touchmotion_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the TouchMotion event with a handler function
Input.EventTouchMotion.Connect(touchmotion_event_handler);
// remove subscription to the TouchMotion event later by the handler function
Input.EventTouchMotion.Disconnect(touchmotion_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection touchmotion_event_connection;
// subscribe to the TouchMotion event with a lambda handler function and keeping the connection
touchmotion_event_connection = Input.EventTouchMotion.Connect((int touch_id) => {
Log.Message("Handling TouchMotion event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
touchmotion_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
touchmotion_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
touchmotion_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring TouchMotion events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventTouchMotion.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventTouchMotion.Enabled = true;
Event<int> EventTouchUp#
Usage Example
// implement the TouchUp event handler
void touchup_event_handler(int touch_id)
{
Log.Message("\Handling TouchUp event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections touchup_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventTouchUp.Connect(touchup_event_connections, touchup_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventTouchUp.Connect(touchup_event_connections, (int touch_id) => {
Log.Message("Handling TouchUp event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
touchup_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the TouchUp event with a handler function
Input.EventTouchUp.Connect(touchup_event_handler);
// remove subscription to the TouchUp event later by the handler function
Input.EventTouchUp.Disconnect(touchup_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection touchup_event_connection;
// subscribe to the TouchUp event with a lambda handler function and keeping the connection
touchup_event_connection = Input.EventTouchUp.Connect((int touch_id) => {
Log.Message("Handling TouchUp event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
touchup_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
touchup_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
touchup_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring TouchUp events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventTouchUp.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventTouchUp.Enabled = true;
Event<int> EventTouchDown#
Usage Example
// implement the TouchDown event handler
void touchdown_event_handler(int touch_id)
{
Log.Message("\Handling TouchDown event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections touchdown_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventTouchDown.Connect(touchdown_event_connections, touchdown_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventTouchDown.Connect(touchdown_event_connections, (int touch_id) => {
Log.Message("Handling TouchDown event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
touchdown_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the TouchDown event with a handler function
Input.EventTouchDown.Connect(touchdown_event_handler);
// remove subscription to the TouchDown event later by the handler function
Input.EventTouchDown.Disconnect(touchdown_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection touchdown_event_connection;
// subscribe to the TouchDown event with a lambda handler function and keeping the connection
touchdown_event_connection = Input.EventTouchDown.Connect((int touch_id) => {
Log.Message("Handling TouchDown event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
touchdown_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
touchdown_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
touchdown_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring TouchDown events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventTouchDown.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventTouchDown.Enabled = true;
Event<uint> EventTextPress#
Usage Example
// implement the TextPress event handler
void textpress_event_handler(uint unicode)
{
Log.Message("\Handling TextPress event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections textpress_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventTextPress.Connect(textpress_event_connections, textpress_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventTextPress.Connect(textpress_event_connections, (uint unicode) => {
Log.Message("Handling TextPress event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
textpress_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the TextPress event with a handler function
Input.EventTextPress.Connect(textpress_event_handler);
// remove subscription to the TextPress event later by the handler function
Input.EventTextPress.Disconnect(textpress_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection textpress_event_connection;
// subscribe to the TextPress event with a lambda handler function and keeping the connection
textpress_event_connection = Input.EventTextPress.Connect((uint unicode) => {
Log.Message("Handling TextPress event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
textpress_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
textpress_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
textpress_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring TextPress events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventTextPress.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventTextPress.Enabled = true;
Event<uint> EventKeyRepeat#
Usage Example
// implement the KeyRepeat event handler
void keyrepeat_event_handler(uint unicode)
{
Log.Message("\Handling KeyRepeat event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections keyrepeat_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventKeyRepeat.Connect(keyrepeat_event_connections, keyrepeat_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventKeyRepeat.Connect(keyrepeat_event_connections, (uint unicode) => {
Log.Message("Handling KeyRepeat event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
keyrepeat_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the KeyRepeat event with a handler function
Input.EventKeyRepeat.Connect(keyrepeat_event_handler);
// remove subscription to the KeyRepeat event later by the handler function
Input.EventKeyRepeat.Disconnect(keyrepeat_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection keyrepeat_event_connection;
// subscribe to the KeyRepeat event with a lambda handler function and keeping the connection
keyrepeat_event_connection = Input.EventKeyRepeat.Connect((uint unicode) => {
Log.Message("Handling KeyRepeat event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
keyrepeat_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
keyrepeat_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
keyrepeat_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring KeyRepeat events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventKeyRepeat.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventKeyRepeat.Enabled = true;
Event<Input.KEY> EventKeyUp#
Usage Example
// implement the KeyUp event handler
void keyup_event_handler(Input.KEY key)
{
Log.Message("\Handling KeyUp event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections keyup_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventKeyUp.Connect(keyup_event_connections, keyup_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventKeyUp.Connect(keyup_event_connections, (Input.KEY key) => {
Log.Message("Handling KeyUp event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
keyup_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the KeyUp event with a handler function
Input.EventKeyUp.Connect(keyup_event_handler);
// remove subscription to the KeyUp event later by the handler function
Input.EventKeyUp.Disconnect(keyup_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection keyup_event_connection;
// subscribe to the KeyUp event with a lambda handler function and keeping the connection
keyup_event_connection = Input.EventKeyUp.Connect((Input.KEY key) => {
Log.Message("Handling KeyUp event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
keyup_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
keyup_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
keyup_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring KeyUp events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventKeyUp.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventKeyUp.Enabled = true;
Event<Input.KEY> EventKeyDown#
Usage Example
// implement the KeyDown event handler
void keydown_event_handler(Input.KEY key)
{
Log.Message("\Handling KeyDown event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections keydown_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventKeyDown.Connect(keydown_event_connections, keydown_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventKeyDown.Connect(keydown_event_connections, (Input.KEY key) => {
Log.Message("Handling KeyDown event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
keydown_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the KeyDown event with a handler function
Input.EventKeyDown.Connect(keydown_event_handler);
// remove subscription to the KeyDown event later by the handler function
Input.EventKeyDown.Disconnect(keydown_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection keydown_event_connection;
// subscribe to the KeyDown event with a lambda handler function and keeping the connection
keydown_event_connection = Input.EventKeyDown.Connect((Input.KEY key) => {
Log.Message("Handling KeyDown event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
keydown_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
keydown_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
keydown_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring KeyDown events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventKeyDown.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventKeyDown.Enabled = true;
Event<int, int> EventMouseMotion#
Usage Example
// implement the MouseMotion event handler
void mousemotion_event_handler(int coord_x, int coord_y)
{
Log.Message("\Handling MouseMotion event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections mousemotion_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventMouseMotion.Connect(mousemotion_event_connections, mousemotion_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventMouseMotion.Connect(mousemotion_event_connections, (int coord_x, int coord_y) => {
Log.Message("Handling MouseMotion event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
mousemotion_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the MouseMotion event with a handler function
Input.EventMouseMotion.Connect(mousemotion_event_handler);
// remove subscription to the MouseMotion event later by the handler function
Input.EventMouseMotion.Disconnect(mousemotion_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection mousemotion_event_connection;
// subscribe to the MouseMotion event with a lambda handler function and keeping the connection
mousemotion_event_connection = Input.EventMouseMotion.Connect((int coord_x, int coord_y) => {
Log.Message("Handling MouseMotion event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
mousemotion_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
mousemotion_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
mousemotion_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring MouseMotion events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventMouseMotion.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventMouseMotion.Enabled = true;
Event<int> EventMouseWheelHorizontal#
Usage Example
// implement the MouseWheelHorizontal event handler
void mousewheelhorizontal_event_handler(int delta_horizontal)
{
Log.Message("\Handling MouseWheelHorizontal event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections mousewheelhorizontal_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventMouseWheelHorizontal.Connect(mousewheelhorizontal_event_connections, mousewheelhorizontal_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventMouseWheelHorizontal.Connect(mousewheelhorizontal_event_connections, (int delta_horizontal) => {
Log.Message("Handling MouseWheelHorizontal event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
mousewheelhorizontal_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the MouseWheelHorizontal event with a handler function
Input.EventMouseWheelHorizontal.Connect(mousewheelhorizontal_event_handler);
// remove subscription to the MouseWheelHorizontal event later by the handler function
Input.EventMouseWheelHorizontal.Disconnect(mousewheelhorizontal_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection mousewheelhorizontal_event_connection;
// subscribe to the MouseWheelHorizontal event with a lambda handler function and keeping the connection
mousewheelhorizontal_event_connection = Input.EventMouseWheelHorizontal.Connect((int delta_horizontal) => {
Log.Message("Handling MouseWheelHorizontal event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
mousewheelhorizontal_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
mousewheelhorizontal_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
mousewheelhorizontal_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring MouseWheelHorizontal events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventMouseWheelHorizontal.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventMouseWheelHorizontal.Enabled = true;
Event<int> EventMouseWheel#
Usage Example
// implement the MouseWheel event handler
void mousewheel_event_handler(int delta_vertical)
{
Log.Message("\Handling MouseWheel event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections mousewheel_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventMouseWheel.Connect(mousewheel_event_connections, mousewheel_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventMouseWheel.Connect(mousewheel_event_connections, (int delta_vertical) => {
Log.Message("Handling MouseWheel event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
mousewheel_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the MouseWheel event with a handler function
Input.EventMouseWheel.Connect(mousewheel_event_handler);
// remove subscription to the MouseWheel event later by the handler function
Input.EventMouseWheel.Disconnect(mousewheel_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection mousewheel_event_connection;
// subscribe to the MouseWheel event with a lambda handler function and keeping the connection
mousewheel_event_connection = Input.EventMouseWheel.Connect((int delta_vertical) => {
Log.Message("Handling MouseWheel event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
mousewheel_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
mousewheel_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
mousewheel_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring MouseWheel events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventMouseWheel.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventMouseWheel.Enabled = true;
Event<Input.MOUSE_BUTTON> EventMouseUp#
Usage Example
// implement the MouseUp event handler
void mouseup_event_handler(Input.MOUSE_BUTTON button)
{
Log.Message("\Handling MouseUp event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections mouseup_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventMouseUp.Connect(mouseup_event_connections, mouseup_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventMouseUp.Connect(mouseup_event_connections, (Input.MOUSE_BUTTON button) => {
Log.Message("Handling MouseUp event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
mouseup_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the MouseUp event with a handler function
Input.EventMouseUp.Connect(mouseup_event_handler);
// remove subscription to the MouseUp event later by the handler function
Input.EventMouseUp.Disconnect(mouseup_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection mouseup_event_connection;
// subscribe to the MouseUp event with a lambda handler function and keeping the connection
mouseup_event_connection = Input.EventMouseUp.Connect((Input.MOUSE_BUTTON button) => {
Log.Message("Handling MouseUp event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
mouseup_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
mouseup_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
mouseup_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring MouseUp events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventMouseUp.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventMouseUp.Enabled = true;
Event<Input.MOUSE_BUTTON> EventMouseDown#
Usage Example
// implement the MouseDown event handler
void mousedown_event_handler(Input.MOUSE_BUTTON button)
{
Log.Message("\Handling MouseDown event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections mousedown_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Input.EventMouseDown.Connect(mousedown_event_connections, mousedown_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Input.EventMouseDown.Connect(mousedown_event_connections, (Input.MOUSE_BUTTON button) => {
Log.Message("Handling MouseDown event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
mousedown_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the MouseDown event with a handler function
Input.EventMouseDown.Connect(mousedown_event_handler);
// remove subscription to the MouseDown event later by the handler function
Input.EventMouseDown.Disconnect(mousedown_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection mousedown_event_connection;
// subscribe to the MouseDown event with a lambda handler function and keeping the connection
mousedown_event_connection = Input.EventMouseDown.Connect((Input.MOUSE_BUTTON button) => {
Log.Message("Handling MouseDown event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
mousedown_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
mousedown_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
mousedown_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring MouseDown events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Input.EventMouseDown.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Input.EventMouseDown.Enabled = true;
Members
InputGamePad GetGamePad ( int num ) #
Returns a gamepad of the given index.Arguments
- int num - Gamepad index.
Return value
InputGamepad object.InputJoystick GetJoystick ( int num ) #
Returns a joystick with the given index.Arguments
- int num - Joystick index.
Return value
InputJoystick object.bool IsKeyPressed ( Input.KEY key ) #
Returns a value indicating if the given key is pressed. Check this value to perform continuous actions.if (Input.IsKeyPressed(Input.KEY.ENTER)) {
Log.Message("the Enter key is held down\n");
}
Arguments
Return value
true if the key is pressed; otherwise, false.bool IsKeyDown ( Input.KEY key ) #
Returns a value indicating if the given key was pressed during the current frame. Check this value to perform one-time actions on pressing a key.if (Input.IsKeyDown(Input.KEY.SPACE)) {
Log.Message("the Space key was pressed\n");
}
Arguments
Return value
True during the first frame when the key was pressed, false for the following ones until it is released and pressed again.bool IsKeyUp ( Input.KEY key ) #
Returns a value indicating if the given key was released during the current frame. Check this value to perform one-time actions on releasing a key.if (Input.IsKeyUp(Input.KEY.F)) {
Log.Message("the F key was released\n");
}
Arguments
Return value
true during the first frame when the key was released; otherwise, false.bool IsMouseButtonPressed ( Input.MOUSE_BUTTON button ) #
Returns a value indicating if the given mouse button is pressed. Check this value to perform continuous actions.if (Input.IsMouseButtonPressed(Input.MOUSE_BUTTON.LEFT)) {
Log.Message("the left mouse button is held down\n");
}
Arguments
- Input.MOUSE_BUTTON button - One of the Input.MOUSE_BUTTON enum values.
Return value
True if the mouse button is pressed; otherwise, false.bool IsMouseButtonDown ( Input.MOUSE_BUTTON button ) #
Returns a value indicating if the given mouse button was pressed during the current frame. Check this value to perform one-time actions on pressing a mouse button.if (Input.IsMouseButtonDown(Input.MOUSE_BUTTON.LEFT)) {
Log.Message("the left mouse button was pressed\n");
}
Arguments
- Input.MOUSE_BUTTON button - One of the Input.MOUSE_BUTTON enum values.
Return value
True during the first frame when the mouse button was released; otherwise, false.bool IsMouseButtonUp ( Input.MOUSE_BUTTON button ) #
Returns a value indicating if the given mouse button was released during the current frame. Check this value to perform one-time actions on releasing a mouse button.if (Input.IsMouseButtonUp(Input.MOUSE_BUTTON.LEFT)) {
Log.Message("left mouse button was released\n");
}
Arguments
- Input.MOUSE_BUTTON button - One of the Input.MOUSE_BUTTON enum values.
Return value
True during the first frame when the mouse button was released; otherwise, false.bool IsTouchPressed ( int index ) #
Returns a value indicating if the touchscreen is pressed by the finger.Arguments
- int index - Touch input index.
Return value
true if the touchscreen is pressed; otherwise, false.bool IsTouchDown ( int index ) #
Returns a value indicating if the given touch was pressed during the current frame.Arguments
- int index - Touch input index.
Return value
true if the touchscreen is pressed during the current frame; otherwise, false.bool IsTouchUp ( int index ) #
Returns a value indicating if the given touch was released.Arguments
- int index - Touch input index.
Return value
true during the first frame when the touch was released; otherwise, false.ivec2 GetTouchPosition ( int index ) #
Returns a vector containing integer values of touch position.Arguments
- int index - Touch input index.
Return value
The touch position.ivec2 GetTouchDelta ( int index ) #
Returns a vector containing screen position change of the touch along the X and Y axes — the difference between the values in the previous and the current frames.Arguments
- int index - Touch input index.
Return value
The touch position delta.InputEventTouch GetTouchEvent ( int index ) #
Returns the action cast to the touch event.Arguments
- int index - Touch input index.
Return value
Touch input event.int GetTouchEvents ( int index, InputEventTouch[] OUT_events ) #
Returns the actions cast to the touch event.Arguments
- int index - Touch input index.
- InputEventTouch[]
OUT_events - The buffer with touch input events.This output buffer is to be filled by the Engine as a result of executing the method.
Return value
Number of touch input events.InputEventKeyboard GetKeyEvent ( Input.KEY key ) #
Returns the currently processed keyboard input event.Arguments
Return value
Keyboard input event, or null if there are no events for the specified key in the current frame.int GetKeyEvents ( Input.KEY key, InputEventKeyboard[] OUT_events ) #
Returns the buffer with events for the specified key.Arguments
- Input.KEY key - One of the Input.KEY enum values.
- InputEventKeyboard[]
OUT_events - The buffer with input events.This output buffer is to be filled by the Engine as a result of executing the method.
string GetKeyName ( Input.KEY key ) #
Returns the specified key name.Arguments
Return value
Key name.Input.KEY GetKeyByName ( string name ) #
Returns the key by its name.Arguments
- string name - Key name.
Return value
One of the Input.KEY enum values.InputEventMouseButton GetMouseButtonEvent ( Input.MOUSE_BUTTON button ) #
Returns the mouse motion input event for the specified button.Arguments
- Input.MOUSE_BUTTON button - One of the Input.MOUSE_BUTTON enum values.
Return value
Mouse motion input event.string GetMouseButtonName ( Input.MOUSE_BUTTON button ) #
Returns the mouse button name.Arguments
- Input.MOUSE_BUTTON button - One of the Input.MOUSE_BUTTON enum values.
Return value
Mouse button name.Input.MOUSE_BUTTON GetMouseButtonByName ( string name ) #
Returns the mouse button by its name.Arguments
- string name - Mouse button name.
Return value
One of the Input.MOUSE_BUTTON enum values.int GetEventsBuffer ( int frame, InputEvent[] OUT_events ) #
Returns the buffer with the input events for the specified frame.Arguments
- int frame - Number of frame for which the buffer of input events is to be obtained. Input events are stored for the last 60 frames. 0 is the current frame, 1 is the previous frame, etc.
- InputEvent[]
OUT_events - The buffer with input events.This output buffer is to be filled by the Engine as a result of executing the method.
void SendEvent ( InputEvent e ) #
Creates a user event and dispatches it to the Engine.Arguments
- InputEvent e - Input event.
void SetEventsFilter ( IntPtr func ) #
Sets a callback function to be executed on receiving input events. This input event filter enables you to reject certain input events for the Engine and get necessary information on all input events.Arguments
- IntPtr func - Input event callback.
bool IsModifierEnabled ( Input.MODIFIER modifier ) #
Returns the value indicating if the specified modifier is enabled.Arguments
- Input.MODIFIER modifier - One of the MODIFIER. enum values.
Return value
true if the modifier is enabled; otherwise, false.uint KeyToUnicode ( Input.KEY key ) #
Returns the specified key transformed to unicode.Arguments
Return value
Unicode symbol.Input.KEY UnicodeToKey ( uint unicode ) #
Returns the specified key transformed to unicode.Arguments
- uint unicode - Unicode symbol.
Return value
One of the Input.KEY enum values.void SetMouseCursorSkinCustom ( Image image ) #
Sets a custom image to be used for the mouse cursor.Arguments
- Image image - Image containing pointer shapes to be set for the mouse cursor (e.g., select, move, resize, etc.).
void SetMouseCursorSkinSystem ( ) #
Sets the current OS cursor skin (pointer shapes like select, move, resize, etc.).void SetMouseCursorSkinDefault ( ) #
Sets the default Engine cursor skin (pointer shapes like select, move, resize, etc.).void SetMouseCursorCustom ( Image image, int x = 0, int y = 0 ) #
Sets a custom image for the OS mouse cursor. The image must be of the square size and RGBA8 format.// create an instance of the Image class
Image cursor = new Image("textures/my_cursor.png");
// set the image as the mouse cursor
Input.SetMouseCursorCustom(cursor);
// show the OS mouse pointer
Input.MouseCursorSystem = true;
Arguments
- Image image - Cursor image to be set.
- int x - X coordinate of the cursor's hot spot.
- int y - Y coordinate of the cursor's hot spot.
void ClearMouseCursorCustom ( ) #
Clears the custom mouse cursor set via the setMouseCursorCustom() method.void UpdateMouseCursor ( ) #
Updates the mouse cursor. This method should be called after making changes to the mouse cursor to apply them all together. After calling this method the cursor shall be updated in the next frame.string GetKeyLocalName ( Input.KEY key ) #
Returns the name for the specified key taken from the currently selected keyboard layout.Arguments
Return value
Localized name for the specified key.int GetMouseButtonEvents ( Input.MOUSE_BUTTON button, InputEventMouseButton[] OUT_events ) #
Returns the number of input events for the specified mouse button and puts the events to the specified output buffer.Arguments
- Input.MOUSE_BUTTON button - One of the Input.MOUSE_BUTTON enum values.
- InputEventMouseButton[]
OUT_events - Buffer with input events.This output buffer is to be filled by the Engine as a result of executing the method.
Return value
Number of input events for the specified mouse button.ivec2 GetForceMousePosition ( ) #
Returns the absolute mouse position obtained from the OS.Return value
The absolute mouse position.bool IsKeyText ( Input.KEY key ) #
Returns a value indicating if the given key has a corresponding printable symbol (current Num Lock state is taken into account). For example, pressing 2 on the numpad with Num Lock enabled produces "2", while with disabled Num Lock the same key acts as a down arrow. Keys like Esc, PrintScreen, BackSpace do not produce any printable symbol at all.Arguments
Return value
true if the key value is a symbol; otherwise, false.string GetModifierName ( Input.MODIFIER modifier ) #
Returns the name of the key modifier by its scancode.Arguments
- Input.MODIFIER modifier - Scancode of the modifier.
Return value
Key name of the modifier.Input.MODIFIER GetModifierByName ( string name ) #
Returns the scancode of the key modifier by its name.Arguments
- string name - Key name of the modifier.
Return value
Scancode of the modifier.InputVRDevice GetVRDevice ( int num ) #
Returns the VR device by its number.Arguments
- int num - Number of the VR device.