This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
VR Development
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Сэмплы материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Unigine::Input Class

Header: #include <UnigineInput.h>

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:

Source code (C++)
#include "AppWorldLogic.h"
#include <UnigineInput.h>

#include <UnigineConsole.h>

#include <UnigineGame.h>
#include <UniginePrimitives.h>

using namespace Unigine;

using namespace Math;

NodePtr box;

float move_speed = 1.0f;
float turn_speed = 30.0f;

int AppWorldLogic::init()
{

	box = Primitives::createBox(vec3_one);

	return 1;
}

int AppWorldLogic::update()
{

	if (Console::isActive())
		return 1;

	if (Input::isKeyPressed(Input::KEY_UP) || Input::isKeyPressed(Input::KEY_W))
		box->translate(Vec3_forward * move_speed * Game::getIFps());

	if (Input::isKeyPressed(Input::KEY_DOWN) || Input::isKeyPressed(Input::KEY_S))
		box->translate(Vec3_back * move_speed * Game::getIFps());

	if (Input::isKeyPressed(Input::KEY_LEFT) || Input::isKeyPressed(Input::KEY_A))
		box->rotate(0.0f, 0.0f, turn_speed * Game::getIFps());

	if (Input::isKeyPressed(Input::KEY_RIGHT) || Input::isKeyPressed(Input::KEY_D))
		box->rotate(0.0f, 0.0f, -turn_speed * Game::getIFps());

	return 1;
}

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.

Source code (C++)
#include "AppWorldLogic.h"
#include <UnigineInput.h>

#include <UnigineConsole.h>

using namespace Unigine;

int AppWorldLogic::update()
{

	if (Input::isKeyDown(Input::KEY_T) || Input::isKeyUp(Input::KEY_T))
	{
		InputEventKeyboardPtr e = Input::getKeyEvent(Input::KEY_T);
		Console::messageLine("%s %d time = %lld frame = %lld", Input::getKeyName(e->getKey()), e->getAction(), e->getTimestamp(), e->getFrame());
	}

	return 1;
}

The following code illustrates receiving the immediate input — the user receives the event notification immediately after filtering:

Source code (C++)
#include "AppWorldLogic.h"
#include <UnigineInput.h>

#include <UnigineConsole.h>

using namespace Unigine;

int AppWorldLogic::init()
{

	Input::getEventImmediateInput().connect(on_immediate_input);

	return 1;
}

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:

Source code (C++)
#include "AppWorldLogic.h"
#include <UnigineInput.h>

using namespace Unigine;

int event_filter(InputEventPtr& e)
{
	switch (e->getType())
	{
	case InputEvent::INPUT_EVENT_KEYBOARD:
	{
		// skip 'W' key repeat events
		InputEventKeyboardPtr k = checked_ptr_cast<InputEventKeyboard>(e);
		if (k->getKey() == Input::KEY_W && k->getAction() == InputEventKeyboard::ACTION_REPEAT)
			return 1;
		break;
	}

	case InputEvent::INPUT_EVENT_MOUSE_MOTION:
	{
		// skip all mouse motion events
		return 1;
	}

	default: break;
	}

	return 0;
}

int AppWorldLogic::init()
{

	Input::setEventsFilter(event_filter);

	return 1;
}

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.

Source code (C++)
#include "AppWorldLogic.h"
#include <UnigineInput.h>

using namespace Unigine;

enum
{
	STATE_OPEN_CONSOLE = 0,
	STATE_TYPING_COMMAND,
	STATE_APPLY_COMMAND,
	STATE_FINISH,
};

int state = STATE_OPEN_CONSOLE;

void emulate_key_input(Input::KEY key)
{
	InputEventKeyboardPtr key_down = InputEventKeyboard::create();
	key_down->setAction(InputEventKeyboard::ACTION_DOWN);
	key_down->setKey(key);

	InputEventKeyboardPtr key_repeat = InputEventKeyboard::create();
	key_repeat->setAction(InputEventKeyboard::ACTION_REPEAT);
	key_repeat->setKey(key);

	InputEventKeyboardPtr key_up = InputEventKeyboard::create();
	key_up->setAction(InputEventKeyboard::ACTION_UP);
	key_up->setKey(key);

	Input::sendEvent(key_down);
	Input::sendEvent(key_repeat);
	Input::sendEvent(key_up);
}

void emulate_text_input(const char *text)
{
	int size = strlen(text);
	for (int i = 0; i < size; i++)
	{
		InputEventTextPtr text_input = InputEventText::create();
		text_input->setUnicode(text[i]);
		Input::sendEvent(text_input);
	}
}

int AppWorldLogic::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;
	}

	return 1;
}

The following code demonstrates how to obtain various button names using the getKeyName(), keyToUnicode(), and getKeyLocalName() methods:

Source code (C++)
#include "AppWorldLogic.h"
#include <UnigineInput.h>

#include <UnigineConsole.h>

using namespace Unigine;

int AppWorldLogic::init()
{

	Console::setOnscreen(true);

	return 1;
}

int AppWorldLogic::update()
{

	auto print_info = [](const char* state, Input::KEY key)
	{
		unsigned int unicode = Input::keyToUnicode(key);
		Console::message("%s: (key='%s', unicode='%s', local_name='%s') ",
			state,
			Input::getKeyName(key),
			String::unicodeToUtf8(unicode).get(),
			Input::getKeyLocalName(key));
	};

	print_info("Up", Input::KEY_W);
	print_info("Jump", Input::KEY_SPACE);
	print_info("Run", Input::KEY_RIGHT_SHIFT);
	Console::message("\n");

	return 1;
}

Input Class

Enums

MOUSE_HANDLE#

ИмяОписание
MOUSE_HANDLE_GRAB = 0The mouse is grabbed when clicked (the cursor disappears and camera movement is controlled by the mouse).
MOUSE_HANDLE_SOFT = 1The mouse cursor disappears after being idle for a short time period.
MOUSE_HANDLE_USER = 2The mouse is not handled by the system (allows input handling by some custom module).

MOUSE_BUTTON#

ИмяОписание
MOUSE_BUTTON_UNKNOWN = 0Unknown mouse button.
MOUSE_BUTTON_LEFT = 1Left mouse button.
MOUSE_BUTTON_MIDDLE = 2Middle mouse button.
MOUSE_BUTTON_RIGHT = 3Right mouse button.
MOUSE_BUTTON_DCLICK = 4Left mouse button double click.
MOUSE_BUTTON_AUX_0 = 5Auxiliary mouse button.
MOUSE_BUTTON_AUX_1 = 6Auxiliary mouse button.
MOUSE_BUTTON_AUX_2 = 7Auxiliary mouse button.
MOUSE_BUTTON_AUX_3 = 8Auxiliary mouse button.
MOUSE_NUM_BUTTONS = 9Number of mouse buttons.

MODIFIER#

ИмяОписание
MODIFIER_LEFT_SHIFT = 0Left Shift key used as modifier.
MODIFIER_RIGHT_SHIFT = 1Right Shift key used as modifier.
MODIFIER_LEFT_CTRL = 2Left Ctrl key used as modifier.
MODIFIER_RIGHT_CTRL = 3Right Ctrl key used as modifier.
MODIFIER_LEFT_ALT = 4Left Alt key used as modifier.
MODIFIER_RIGHT_ALT = 5Right Alt key used as modifier.
MODIFIER_LEFT_CMD = 6Left Command key used as modifier.
MODIFIER_RIGHT_CMD = 7Right Command key used as modifier.
MODIFIER_NUM_LOCK = 8 Num Lock key used as modifier.
MODIFIER_CAPS_LOCK = 9 Caps Lock key used as modifier.
MODIFIER_SCROLL_LOCK = 10 Scroll Lock key used as modifier.
MODIFIER_ALT_GR = 11 Alt Gr key used as modifier.
MODIFIER_ANY_SHIFT = 12Any Shift key used as modifier.
MODIFIER_ANY_CTRL = 13Any Ctrl key used as modifier.
MODIFIER_ANY_ALT = 14Any Alt key used as modifier.
MODIFIER_ANY_CMD = 15Any Command key used as modifier.
MODIFIER_NONE = 16No modifier is specified.
NUM_MODIFIERS = 17Total number of modifiers.

KEY#

ИмяОписание
KEY_UNKNOWN = 0Unknown key
KEY_ESC = 1 Escape key
KEY_F1 = 2F1 key
KEY_F2 = 3F2 key
KEY_F3 = 4F3 key
KEY_F4 = 5F4 key
KEY_F5 = 6F5 key
KEY_F6 = 7F6 key
KEY_F7 = 8F7 key
KEY_F8 = 9F8 key
KEY_F9 = 10F9 key
KEY_F10 = 11F10 key
KEY_F11 = 12F11 key
KEY_F12 = 13F12 key
KEY_PRINTSCREEN = 14 Print Screen key
KEY_SCROLL_LOCK = 15 Scroll Lock key
KEY_PAUSE = 16 Pause key
KEY_BACK_QUOTE = 17Back quote key
KEY_DIGIT_1 = 18The 1 key of the alphanumeric keyboard
KEY_DIGIT_2 = 19The 2 key of the alphanumeric keyboard
KEY_DIGIT_3 = 20The 3 key of the alphanumeric keyboard
KEY_DIGIT_4 = 21The 4 key of the alphanumeric keyboard
KEY_DIGIT_5 = 22The 5 key of the alphanumeric keyboard
KEY_DIGIT_6 = 23The 6 key of the alphanumeric keyboard
KEY_DIGIT_7 = 24The 7 key of the alphanumeric keyboard
KEY_DIGIT_8 = 25The 8 key of the alphanumeric keyboard
KEY_DIGIT_9 = 26The 9 key of the alphanumeric keyboard
KEY_DIGIT_0 = 27The 0 key of the alphanumeric keyboard
KEY_MINUS = 28Minus key
KEY_EQUALS = 29Equals key
KEY_BACKSPACE = 30Backspace key
KEY_TAB = 31 Tab key
KEY_Q = 32 Q key
KEY_W = 33 W key
KEY_E = 34 E key
KEY_R = 35 R key
KEY_T = 36 T key
KEY_Y = 37 Y key
KEY_U = 38 U key
KEY_I = 39 I key
KEY_O = 40 O key
KEY_P = 41 P key
KEY_LEFT_BRACKET = 42Left square bracket key
KEY_RIGHT_BRACKET = 43Right square bracket key
KEY_ENTER = 44 Enter key
KEY_CAPS_LOCK = 45 Caps Lock key
KEY_A = 46 A key
KEY_S = 47 S key
KEY_D = 48 D key
KEY_F = 49 F key
KEY_G = 50 G key
KEY_H = 51 H key
KEY_J = 52 J key
KEY_K = 53 K key
KEY_L = 54 L key
KEY_SEMICOLON = 55Semicolon key
KEY_QUOTE = 56Quote key
KEY_BACK_SLASH = 57Backward slash key
KEY_LEFT_SHIFT = 58Left Shift key
KEY_LESS = 59Less than key
KEY_Z = 60Z key
KEY_X = 61X key
KEY_C = 62C key
KEY_V = 63V key
KEY_B = 64B key
KEY_N = 65N key
KEY_M = 66M key
KEY_COMMA = 67Comma key
KEY_DOT = 68Dot key
KEY_SLASH = 69Slash key
KEY_RIGHT_SHIFT = 70Right Shift key
KEY_LEFT_CTRL = 71Left Ctrl key
KEY_LEFT_CMD = 72Left Command key
KEY_LEFT_ALT = 73Left Alt key
KEY_SPACE = 74Space key
KEY_RIGHT_ALT = 75Right Alt key
KEY_RIGHT_CMD = 76Right Command key
KEY_MENU = 77Menu key
KEY_RIGHT_CTRL = 78Right Ctrl key
KEY_INSERT = 79 Insert key
KEY_DELETE = 80 Delete key
KEY_HOME = 81 Home key
KEY_END = 82 End key
KEY_PGUP = 83Page Up key
KEY_PGDOWN = 84Page down
KEY_UP = 85Up arrow key
KEY_LEFT = 86Left arrow key
KEY_DOWN = 87Down arrow key
KEY_RIGHT = 88Right arrow key
KEY_NUM_LOCK = 89 Num Lock key
KEY_NUMPAD_DIVIDE = 90Divide key of the numeric keypad
KEY_NUMPAD_MULTIPLY = 91Multiply key of the numeric keypad
KEY_NUMPAD_MINUS = 92Minus key of the numeric keypad
KEY_NUMPAD_DIGIT_7 = 93The 7 key of the numeric keypad
KEY_NUMPAD_DIGIT_8 = 94The 8 key of the numeric keypad
KEY_NUMPAD_DIGIT_9 = 95The 9 key of the numeric keypad
KEY_NUMPAD_PLUS = 96Plus key of the numeric keypad
KEY_NUMPAD_DIGIT_4 = 97The 4 key of the numeric keypad
KEY_NUMPAD_DIGIT_5 = 98The 5 key of the numeric keypad
KEY_NUMPAD_DIGIT_6 = 99The 6 key of the numeric keypad
KEY_NUMPAD_DIGIT_1 = 100The 1 key of the numeric keypad
KEY_NUMPAD_DIGIT_2 = 101The 2 key of the numeric keypad
KEY_NUMPAD_DIGIT_3 = 102The 3 key of the numeric keypad
KEY_NUMPAD_ENTER = 103 Enter key of the numeric keypad
KEY_NUMPAD_DIGIT_0 = 104The 0 key of the numeric keypad
KEY_NUMPAD_DOT = 105Dot key of the numeric keypad
KEY_ANY_SHIFT = 106Any Shift key
KEY_ANY_CTRL = 107Any Ctrl key
KEY_ANY_ALT = 108Any Alt key
KEY_ANY_CMD = 109Any Command key
KEY_ANY_UP = 110Any up arrow key
KEY_ANY_LEFT = 111Any left arrow key
KEY_ANY_DOWN = 112Any down arrow key
KEY_ANY_RIGHT = 113Any right arrow key
KEY_ANY_ENTER = 114Any up arrow key
KEY_ANY_DELETE = 115Any Delete key
KEY_ANY_INSERT = 116Any Insert key
KEY_ANY_HOME = 117Any Home key
KEY_ANY_END = 118Any End key
KEY_ANY_PGUP = 119Any Page Up key
KEY_ANY_PGDOWN = 120Any Page Down key
KEY_ANY_DIGIT_1 = 121The 1 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_DIGIT_2 = 122The 2 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_DIGIT_3 = 123The 3 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_DIGIT_4 = 124The 4 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_DIGIT_5 = 125The 5 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_DIGIT_6 = 126The 6 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_DIGIT_7 = 127The 7 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_DIGIT_8 = 128The 8 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_DIGIT_9 = 129The 9 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_DIGIT_0 = 130The 0 key of either alphanumeric keyboard or numeric keypad
KEY_ANY_MINUS = 131Any minus key
KEY_ANY_EQUALS = 132Any Equals key
KEY_ANY_DOT = 133Any dot key
NUM_KEYS = 134Number of keys.

DEVICE#

ИмяОписание
DEVICE_UNKNOWN = 0Unknown device.
DEVICE_GAME_CONTROLLER = 1Game controller device.
DEVICE_WHEEL = 2Wheel device.
DEVICE_ARCADE_STICK = 3Arcade stick device.
DEVICE_FLIGHT_STICK = 4Flight stick device.
DEVICE_DANCE_PAD = 5Dance pad device.
DEVICE_GUITAR = 6Guitar.
DEVICE_DRUM_KIT = 7Drum kit.
DEVICE_VR = 8

GAMEPAD_BUTTON#

Buttons of the gamepad.
ИмяОписание
GAMEPAD_BUTTON_A = 0Button A of the gamepad.
GAMEPAD_BUTTON_B = 1Button B of the gamepad.
GAMEPAD_BUTTON_X = 2Button X of the gamepad.
GAMEPAD_BUTTON_Y = 3Button Y of the gamepad.
GAMEPAD_BUTTON_BACK = 4Button "Back" of the gamepad.
GAMEPAD_BUTTON_START = 5Button "Start" of the gamepad.
GAMEPAD_BUTTON_DPAD_UP = 6Button "Up" of the gamepad.
GAMEPAD_BUTTON_DPAD_DOWN = 7Button "Down" of the gamepad.
GAMEPAD_BUTTON_DPAD_LEFT = 8Button "Left" of the gamepad.
GAMEPAD_BUTTON_DPAD_RIGHT = 9Button "Right" of the gamepad.
GAMEPAD_BUTTON_THUMB_LEFT = 10Left thumbstick button of the gamepad.
GAMEPAD_BUTTON_THUMB_RIGHT = 11Right thumbstick button of the gamepad.
GAMEPAD_BUTTON_SHOULDER_LEFT = 12Left shoulder (bumper) button of the gamepad.
GAMEPAD_BUTTON_SHOULDER_RIGHT = 13Right shoulder (bumper) button of the gamepad.
GAMEPAD_BUTTON_GUIDE = 14Button "Guide" of the gamepad.
GAMEPAD_BUTTON_MISC1 = 15The miscellaneous button of the gamepad.
GAMEPAD_BUTTON_TOUCHPAD = 16Touchpad of the gamepad.
NUM_GAMEPAD_BUTTONS = 17Number of buttons on a gamepad.

GAMEPAD_AXIS#

ИмяОписание
GAMEPAD_AXIS_LEFT_X = 0X axis of the left stick of the gamepad.
GAMEPAD_AXIS_LEFT_Y = 1Y axis of the left stick of the gamepad.
GAMEPAD_AXIS_RIGHT_X = 2X axis of the right stick of the gamepad.
GAMEPAD_AXIS_RIGHT_Y = 3Y axis of the right stick of the gamepad.
GAMEPAD_AXIS_LEFT_TRIGGER = 4Left trigger of the gamepad.
GAMEPAD_AXIS_RIGHT_TRIGGER = 5Right trigger of the gamepad.
NUM_GAMEPAD_AXES = 6Number of axes on a gamepad.

JOYSTICK_POV#

POV (Point-of-View) switch or DPad states.
ИмяОписание
JOYSTICK_POV_NOT_PRESSED = 0POV (Point-of-View) hat switch or D-Pad (directional pad) button is not pressed.
JOYSTICK_POV_UP = 1POV (Point-of-View) hat switch or D-Pad (directional pad) is in up position.
JOYSTICK_POV_UP_RIGHT = 2POV (Point-of-View) hat switch or D-Pad (directional pad) is in right-up position.
JOYSTICK_POV_RIGHT = 3POV (Point-of-View) hat switch or D-Pad (directional pad) is in right position.
JOYSTICK_POV_DOWN_RIGHT = 4POV (Point-of-View) hat switch or D-Pad (directional pad) is in down-right position.
JOYSTICK_POV_DOWN = 5POV (Point-of-View) hat switch or D-Pad (directional pad) is in down position.
JOYSTICK_POV_DOWN_LEFT = 6POV (Point-of-View) hat switch or D-Pad (directional pad) is in down-left position.
JOYSTICK_POV_LEFT = 7POV (Point-of-View) hat switch or D-Pad (directional pad) is in left position.
JOYSTICK_POV_UP_LEFT = 8POV (Point-of-View) hat switch or D-Pad (directional pad) is in left-up position.

VR_BUTTON#

ИмяОписание
VR_BUTTON_SYSTEM_LEFT = 0Left system button.
VR_BUTTON_SYSTEM_RIGHT = 1Right system button.
VR_BUTTON_A = 2A button reserved for the controller.
VR_BUTTON_B = 3B button reserved for the controller.
VR_BUTTON_X = 4X button reserved for the controller.
VR_BUTTON_Y = 5Y button reserved for the controller.
VR_BUTTON_GRIP_LEFT = 6Left grip button.
VR_BUTTON_AXIS_0_LEFT = 7The axis reserved for the left controller.
VR_BUTTON_AXIS_1_LEFT = 8The axis reserved for the left controller.
VR_BUTTON_AXIS_2_LEFT = 9The axis reserved for the left controller.
VR_BUTTON_AXIS_3_LEFT = 10The axis reserved for the left controller.
VR_BUTTON_AXIS_4_LEFT = 11The axis reserved for the left controller.
VR_BUTTON_GRIP_RIGHT = 12Right grip button.
VR_BUTTON_AXIS_0_RIGHT = 13The axis reserved for the right controller.
VR_BUTTON_AXIS_1_RIGHT = 14The axis reserved for the right controller.
VR_BUTTON_AXIS_2_RIGHT = 15The axis reserved for the right controller.
VR_BUTTON_AXIS_3_RIGHT = 16The axis reserved for the right controller.
VR_BUTTON_AXIS_4_RIGHT = 17The axis reserved for the right controller.
VR_BUTTON_DPAD_UP = 18Sensor panel up button.
VR_BUTTON_DPAD_DOWN = 19Sensor panel down button.
VR_BUTTON_DPAD_LEFT = 20Sensor panel left button.
VR_BUTTON_DPAD_RIGHT = 21Sensor panel right button.
VR_BUTTON_PROXIMITY_SENSOR = 22Proximity sensor.
VR_BUTTON_APPLICATION = 23Application menu button.
NUM_VR_BUTTONS = 24Total number of VR buttons and axes.

Members

getNumJoysticks() const#

Returns the current number of joysticks.

Return value

Current

getNumGamePads() const#

Returns the current number of all gamepads.

Return value

Current

getMouseWheelHorizontal() const#

Returns the current horizontal mouse scroll value.

Return value

Current

getMouseWheel() const#

Returns the current vertical mouse scroll value.

Return value

Current

getMouseDeltaPosition() const#

Returns the current vector containing delta values of the mouse cursor position.

Return value

Current

void setMousePosition ( ) #

Sets a new vector containing integer values of the mouse cursor position.

Arguments

  • position - The

getMousePosition() const#

Returns the current vector containing integer values of the mouse cursor position.

Return value

Current

bool isEmptyClipboard() const#

Returns the current value indicating if the clipboard is empty.

Return value

true if if the clipboard is empty is enabled; otherwise false.

Math::ivec2 getMouseDeltaRaw() const#

Returns the current The change in the absolute mouse position (not the screen cursor), dots per inch.

Return value

Current

Ptr<InputVRController> getVRControllerTreadmill() const#

Returns the current

Return value

Current

Ptr<InputVRController> getVRControllerRight() const#

Returns the current

Return value

Current

Ptr<InputVRController> getVRControllerLeft() const#

Returns the current

Return value

Current

Ptr<InputVRHead> getVRHead() const#

Returns the current

Return value

Current

int getNumVRDevices() const#

Returns the current

Return value

Current

Event<const Ptr<InputEvent> &> getEventImmediateInput() const#

event triggered immediately at input as received from proxy before being processed by the engine. This event can be triggered in different threads depending on the proxy implementation. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the ImmediateInput event handler
void immediateinput_event_handler(const Ptr<InputEvent> & event)
{
	Log::message("\Handling ImmediateInput event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections immediateinput_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventImmediateInput().connect(immediateinput_event_connections, immediateinput_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventImmediateInput().connect(immediateinput_event_connections, [](const Ptr<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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection immediateinput_event_connection;

// subscribe for the ImmediateInput event with a handler function keeping the connection
Input::getEventImmediateInput().connect(immediateinput_event_connection, immediateinput_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
immediateinput_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
immediateinput_event_connection.setEnabled(true);

// ...

// remove subscription for the ImmediateInput event via the connection
immediateinput_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A ImmediateInput event handler implemented as a class member
	void event_handler(const Ptr<InputEvent> & event)
	{
		Log::message("\Handling ImmediateInput event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventImmediateInput().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the ImmediateInput event with a handler function
Input::getEventImmediateInput().connect(immediateinput_event_handler);


// remove subscription for the ImmediateInput event later by the handler function
Input::getEventImmediateInput().disconnect(immediateinput_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId immediateinput_handler_id;

// subscribe for the ImmediateInput event with a lambda handler function and keeping connection ID
immediateinput_handler_id = Input::getEventImmediateInput().connect([](const Ptr<InputEvent> & event) { 
		Log::message("\Handling ImmediateInput event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventImmediateInput().disconnect(immediateinput_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all ImmediateInput events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventImmediateInput().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventImmediateInput().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(const Ptr<InputEvent> & event)

Return value

Current

Event<int, Input::JOYSTICK_POV> getEventJoyPovMotion() const#

event triggered when a joystick POV state value is changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the JoyPovMotion event handler
void joypovmotion_event_handler(int joystick_id,  Input::JOYSTICK_POV pov_index)
{
	Log::message("\Handling JoyPovMotion event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections joypovmotion_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventJoyPovMotion().connect(joypovmotion_event_connections, joypovmotion_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventJoyPovMotion().connect(joypovmotion_event_connections, [](int joystick_id,  Input::JOYSTICK_POV 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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection joypovmotion_event_connection;

// subscribe for the JoyPovMotion event with a handler function keeping the connection
Input::getEventJoyPovMotion().connect(joypovmotion_event_connection, joypovmotion_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
joypovmotion_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
joypovmotion_event_connection.setEnabled(true);

// ...

// remove subscription for the JoyPovMotion event via the connection
joypovmotion_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A JoyPovMotion event handler implemented as a class member
	void event_handler(int joystick_id,  Input::JOYSTICK_POV pov_index)
	{
		Log::message("\Handling JoyPovMotion event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventJoyPovMotion().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the JoyPovMotion event with a handler function
Input::getEventJoyPovMotion().connect(joypovmotion_event_handler);


// remove subscription for the JoyPovMotion event later by the handler function
Input::getEventJoyPovMotion().disconnect(joypovmotion_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId joypovmotion_handler_id;

// subscribe for the JoyPovMotion event with a lambda handler function and keeping connection ID
joypovmotion_handler_id = Input::getEventJoyPovMotion().connect([](int joystick_id,  Input::JOYSTICK_POV pov_index) { 
		Log::message("\Handling JoyPovMotion event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventJoyPovMotion().disconnect(joypovmotion_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all JoyPovMotion events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventJoyPovMotion().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventJoyPovMotion().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(int joystick_id, Input::JOYSTICK_POV pov_index)

Return value

Current

Event<int, int> getEventJoyAxisMotion() const#

event triggered when a joystick axis state value is changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the JoyAxisMotion event handler
void joyaxismotion_event_handler(joystick_id)
{
	Log::message("\Handling JoyAxisMotion event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections joyaxismotion_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventJoyAxisMotion().connect(joyaxismotion_event_connections, joyaxismotion_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventJoyAxisMotion().connect(joyaxismotion_event_connections, [](joystick_id) { 
		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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection joyaxismotion_event_connection;

// subscribe for the JoyAxisMotion event with a handler function keeping the connection
Input::getEventJoyAxisMotion().connect(joyaxismotion_event_connection, joyaxismotion_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
joyaxismotion_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
joyaxismotion_event_connection.setEnabled(true);

// ...

// remove subscription for the JoyAxisMotion event via the connection
joyaxismotion_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A JoyAxisMotion event handler implemented as a class member
	void event_handler(joystick_id)
	{
		Log::message("\Handling JoyAxisMotion event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventJoyAxisMotion().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the JoyAxisMotion event with a handler function
Input::getEventJoyAxisMotion().connect(joyaxismotion_event_handler);


// remove subscription for the JoyAxisMotion event later by the handler function
Input::getEventJoyAxisMotion().disconnect(joyaxismotion_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId joyaxismotion_handler_id;

// subscribe for the JoyAxisMotion event with a lambda handler function and keeping connection ID
joyaxismotion_handler_id = Input::getEventJoyAxisMotion().connect([](joystick_id) { 
		Log::message("\Handling JoyAxisMotion event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventJoyAxisMotion().disconnect(joyaxismotion_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all JoyAxisMotion events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventJoyAxisMotion().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventJoyAxisMotion().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(joystick_id)

Return value

Current

Event<int, int> getEventJoyButtonUp() const#

event triggered when a joystick button is released. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the JoyButtonUp event handler
void joybuttonup_event_handler(joystick_id)
{
	Log::message("\Handling JoyButtonUp event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections joybuttonup_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventJoyButtonUp().connect(joybuttonup_event_connections, joybuttonup_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventJoyButtonUp().connect(joybuttonup_event_connections, [](joystick_id) { 
		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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection joybuttonup_event_connection;

// subscribe for the JoyButtonUp event with a handler function keeping the connection
Input::getEventJoyButtonUp().connect(joybuttonup_event_connection, joybuttonup_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
joybuttonup_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
joybuttonup_event_connection.setEnabled(true);

// ...

// remove subscription for the JoyButtonUp event via the connection
joybuttonup_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A JoyButtonUp event handler implemented as a class member
	void event_handler(joystick_id)
	{
		Log::message("\Handling JoyButtonUp event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventJoyButtonUp().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the JoyButtonUp event with a handler function
Input::getEventJoyButtonUp().connect(joybuttonup_event_handler);


// remove subscription for the JoyButtonUp event later by the handler function
Input::getEventJoyButtonUp().disconnect(joybuttonup_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId joybuttonup_handler_id;

// subscribe for the JoyButtonUp event with a lambda handler function and keeping connection ID
joybuttonup_handler_id = Input::getEventJoyButtonUp().connect([](joystick_id) { 
		Log::message("\Handling JoyButtonUp event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventJoyButtonUp().disconnect(joybuttonup_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all JoyButtonUp events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventJoyButtonUp().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventJoyButtonUp().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(joystick_id)

Return value

Current

Event<int, int> getEventJoyButtonDown() const#

event triggered when a joystick button is pressed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the JoyButtonDown event handler
void joybuttondown_event_handler(joystick_id)
{
	Log::message("\Handling JoyButtonDown event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections joybuttondown_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventJoyButtonDown().connect(joybuttondown_event_connections, joybuttondown_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventJoyButtonDown().connect(joybuttondown_event_connections, [](joystick_id) { 
		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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection joybuttondown_event_connection;

// subscribe for the JoyButtonDown event with a handler function keeping the connection
Input::getEventJoyButtonDown().connect(joybuttondown_event_connection, joybuttondown_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
joybuttondown_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
joybuttondown_event_connection.setEnabled(true);

// ...

// remove subscription for the JoyButtonDown event via the connection
joybuttondown_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A JoyButtonDown event handler implemented as a class member
	void event_handler(joystick_id)
	{
		Log::message("\Handling JoyButtonDown event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventJoyButtonDown().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the JoyButtonDown event with a handler function
Input::getEventJoyButtonDown().connect(joybuttondown_event_handler);


// remove subscription for the JoyButtonDown event later by the handler function
Input::getEventJoyButtonDown().disconnect(joybuttondown_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId joybuttondown_handler_id;

// subscribe for the JoyButtonDown event with a lambda handler function and keeping connection ID
joybuttondown_handler_id = Input::getEventJoyButtonDown().connect([](joystick_id) { 
		Log::message("\Handling JoyButtonDown event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventJoyButtonDown().disconnect(joybuttondown_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all JoyButtonDown events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventJoyButtonDown().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventJoyButtonDown().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(joystick_id)

Return value

Current

Event<int> getEventJoyDisconnected() const#

event triggered when a joystick is disconnected. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the JoyDisconnected event handler
void joydisconnected_event_handler(joystick_id)
{
	Log::message("\Handling JoyDisconnected event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections joydisconnected_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventJoyDisconnected().connect(joydisconnected_event_connections, joydisconnected_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventJoyDisconnected().connect(joydisconnected_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection joydisconnected_event_connection;

// subscribe for the JoyDisconnected event with a handler function keeping the connection
Input::getEventJoyDisconnected().connect(joydisconnected_event_connection, joydisconnected_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
joydisconnected_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
joydisconnected_event_connection.setEnabled(true);

// ...

// remove subscription for the JoyDisconnected event via the connection
joydisconnected_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A JoyDisconnected event handler implemented as a class member
	void event_handler(joystick_id)
	{
		Log::message("\Handling JoyDisconnected event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventJoyDisconnected().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the JoyDisconnected event with a handler function
Input::getEventJoyDisconnected().connect(joydisconnected_event_handler);


// remove subscription for the JoyDisconnected event later by the handler function
Input::getEventJoyDisconnected().disconnect(joydisconnected_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId joydisconnected_handler_id;

// subscribe for the JoyDisconnected event with a lambda handler function and keeping connection ID
joydisconnected_handler_id = Input::getEventJoyDisconnected().connect([](joystick_id) { 
		Log::message("\Handling JoyDisconnected event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventJoyDisconnected().disconnect(joydisconnected_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all JoyDisconnected events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventJoyDisconnected().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventJoyDisconnected().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(joystick_id)

Return value

Current

Event<int> getEventJoyConnected() const#

event triggered when a joystick is connected. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the JoyConnected event handler
void joyconnected_event_handler(joystick_id)
{
	Log::message("\Handling JoyConnected event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections joyconnected_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventJoyConnected().connect(joyconnected_event_connections, joyconnected_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventJoyConnected().connect(joyconnected_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection joyconnected_event_connection;

// subscribe for the JoyConnected event with a handler function keeping the connection
Input::getEventJoyConnected().connect(joyconnected_event_connection, joyconnected_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
joyconnected_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
joyconnected_event_connection.setEnabled(true);

// ...

// remove subscription for the JoyConnected event via the connection
joyconnected_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A JoyConnected event handler implemented as a class member
	void event_handler(joystick_id)
	{
		Log::message("\Handling JoyConnected event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventJoyConnected().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the JoyConnected event with a handler function
Input::getEventJoyConnected().connect(joyconnected_event_handler);


// remove subscription for the JoyConnected event later by the handler function
Input::getEventJoyConnected().disconnect(joyconnected_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId joyconnected_handler_id;

// subscribe for the JoyConnected event with a lambda handler function and keeping connection ID
joyconnected_handler_id = Input::getEventJoyConnected().connect([](joystick_id) { 
		Log::message("\Handling JoyConnected event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventJoyConnected().disconnect(joyconnected_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all JoyConnected events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventJoyConnected().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventJoyConnected().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(joystick_id)

Return value

Current

Event<int, int> getEventVrDeviceAxisMotion() const#

event triggered when a VR device axis state value is changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the VrDeviceAxisMotion event handler
void vrdeviceaxismotion_event_handler(device_id)
{
	Log::message("\Handling VrDeviceAxisMotion event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections vrdeviceaxismotion_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventVrDeviceAxisMotion().connect(vrdeviceaxismotion_event_connections, vrdeviceaxismotion_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventVrDeviceAxisMotion().connect(vrdeviceaxismotion_event_connections, [](device_id) { 
		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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection vrdeviceaxismotion_event_connection;

// subscribe for the VrDeviceAxisMotion event with a handler function keeping the connection
Input::getEventVrDeviceAxisMotion().connect(vrdeviceaxismotion_event_connection, vrdeviceaxismotion_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
vrdeviceaxismotion_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
vrdeviceaxismotion_event_connection.setEnabled(true);

// ...

// remove subscription for the VrDeviceAxisMotion event via the connection
vrdeviceaxismotion_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A VrDeviceAxisMotion event handler implemented as a class member
	void event_handler(device_id)
	{
		Log::message("\Handling VrDeviceAxisMotion event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventVrDeviceAxisMotion().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the VrDeviceAxisMotion event with a handler function
Input::getEventVrDeviceAxisMotion().connect(vrdeviceaxismotion_event_handler);


// remove subscription for the VrDeviceAxisMotion event later by the handler function
Input::getEventVrDeviceAxisMotion().disconnect(vrdeviceaxismotion_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId vrdeviceaxismotion_handler_id;

// subscribe for the VrDeviceAxisMotion event with a lambda handler function and keeping connection ID
vrdeviceaxismotion_handler_id = Input::getEventVrDeviceAxisMotion().connect([](device_id) { 
		Log::message("\Handling VrDeviceAxisMotion event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventVrDeviceAxisMotion().disconnect(vrdeviceaxismotion_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all VrDeviceAxisMotion events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventVrDeviceAxisMotion().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventVrDeviceAxisMotion().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(device_id)

Return value

Current

Event<int, Input::VR_BUTTON> getEventVrDeviceButtonTouchUp() const#

event triggered when a finger is withdrawn from a VR device button. If the finger is releasing a button that has been pressed, this event is triggered along with EventVrDeviceButtonUp. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections vrdevicebuttontouchup_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventVrDeviceButtonTouchUp().connect(vrdevicebuttontouchup_event_connections, vrdevicebuttontouchup_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventVrDeviceButtonTouchUp().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection vrdevicebuttontouchup_event_connection;

// subscribe for the VrDeviceButtonTouchUp event with a handler function keeping the connection
Input::getEventVrDeviceButtonTouchUp().connect(vrdevicebuttontouchup_event_connection, vrdevicebuttontouchup_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
vrdevicebuttontouchup_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
vrdevicebuttontouchup_event_connection.setEnabled(true);

// ...

// remove subscription for the VrDeviceButtonTouchUp event via the connection
vrdevicebuttontouchup_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A VrDeviceButtonTouchUp event handler implemented as a class member
	void event_handler(int device_id,  Input::VR_BUTTON button)
	{
		Log::message("\Handling VrDeviceButtonTouchUp event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventVrDeviceButtonTouchUp().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the VrDeviceButtonTouchUp event with a handler function
Input::getEventVrDeviceButtonTouchUp().connect(vrdevicebuttontouchup_event_handler);


// remove subscription for the VrDeviceButtonTouchUp event later by the handler function
Input::getEventVrDeviceButtonTouchUp().disconnect(vrdevicebuttontouchup_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId vrdevicebuttontouchup_handler_id;

// subscribe for the VrDeviceButtonTouchUp event with a lambda handler function and keeping connection ID
vrdevicebuttontouchup_handler_id = Input::getEventVrDeviceButtonTouchUp().connect([](int device_id,  Input::VR_BUTTON button) { 
		Log::message("\Handling VrDeviceButtonTouchUp event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventVrDeviceButtonTouchUp().disconnect(vrdevicebuttontouchup_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all VrDeviceButtonTouchUp events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventVrDeviceButtonTouchUp().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventVrDeviceButtonTouchUp().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(int device_id, Input::VR_BUTTON button)

Return value

Current

Event<int, Input::VR_BUTTON> getEventVrDeviceButtonTouchDown() const#

event triggered when a VR device button is touched. If the button has been touched and pressed, EventVrDeviceButtonDown is triggered along with this event. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections vrdevicebuttontouchdown_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventVrDeviceButtonTouchDown().connect(vrdevicebuttontouchdown_event_connections, vrdevicebuttontouchdown_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventVrDeviceButtonTouchDown().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection vrdevicebuttontouchdown_event_connection;

// subscribe for the VrDeviceButtonTouchDown event with a handler function keeping the connection
Input::getEventVrDeviceButtonTouchDown().connect(vrdevicebuttontouchdown_event_connection, vrdevicebuttontouchdown_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
vrdevicebuttontouchdown_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
vrdevicebuttontouchdown_event_connection.setEnabled(true);

// ...

// remove subscription for the VrDeviceButtonTouchDown event via the connection
vrdevicebuttontouchdown_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A VrDeviceButtonTouchDown event handler implemented as a class member
	void event_handler(int device_id,  Input::VR_BUTTON button)
	{
		Log::message("\Handling VrDeviceButtonTouchDown event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventVrDeviceButtonTouchDown().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the VrDeviceButtonTouchDown event with a handler function
Input::getEventVrDeviceButtonTouchDown().connect(vrdevicebuttontouchdown_event_handler);


// remove subscription for the VrDeviceButtonTouchDown event later by the handler function
Input::getEventVrDeviceButtonTouchDown().disconnect(vrdevicebuttontouchdown_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId vrdevicebuttontouchdown_handler_id;

// subscribe for the VrDeviceButtonTouchDown event with a lambda handler function and keeping connection ID
vrdevicebuttontouchdown_handler_id = Input::getEventVrDeviceButtonTouchDown().connect([](int device_id,  Input::VR_BUTTON button) { 
		Log::message("\Handling VrDeviceButtonTouchDown event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventVrDeviceButtonTouchDown().disconnect(vrdevicebuttontouchdown_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all VrDeviceButtonTouchDown events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventVrDeviceButtonTouchDown().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventVrDeviceButtonTouchDown().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(int device_id, Input::VR_BUTTON button)

Return value

Current

Event<int, Input::VR_BUTTON> getEventVrDeviceButtonUp() const#

event triggered when a VR device button is released. If the finger is withdrawn from the button that has been pressed, EventVrDeviceButtonTouchUp is triggered along with this event. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections vrdevicebuttonup_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventVrDeviceButtonUp().connect(vrdevicebuttonup_event_connections, vrdevicebuttonup_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventVrDeviceButtonUp().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection vrdevicebuttonup_event_connection;

// subscribe for the VrDeviceButtonUp event with a handler function keeping the connection
Input::getEventVrDeviceButtonUp().connect(vrdevicebuttonup_event_connection, vrdevicebuttonup_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
vrdevicebuttonup_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
vrdevicebuttonup_event_connection.setEnabled(true);

// ...

// remove subscription for the VrDeviceButtonUp event via the connection
vrdevicebuttonup_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A VrDeviceButtonUp event handler implemented as a class member
	void event_handler(int device_id,  Input::VR_BUTTON button)
	{
		Log::message("\Handling VrDeviceButtonUp event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventVrDeviceButtonUp().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the VrDeviceButtonUp event with a handler function
Input::getEventVrDeviceButtonUp().connect(vrdevicebuttonup_event_handler);


// remove subscription for the VrDeviceButtonUp event later by the handler function
Input::getEventVrDeviceButtonUp().disconnect(vrdevicebuttonup_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId vrdevicebuttonup_handler_id;

// subscribe for the VrDeviceButtonUp event with a lambda handler function and keeping connection ID
vrdevicebuttonup_handler_id = Input::getEventVrDeviceButtonUp().connect([](int device_id,  Input::VR_BUTTON button) { 
		Log::message("\Handling VrDeviceButtonUp event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventVrDeviceButtonUp().disconnect(vrdevicebuttonup_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all VrDeviceButtonUp events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventVrDeviceButtonUp().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventVrDeviceButtonUp().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(int device_id, Input::VR_BUTTON button)

Return value

Current

Event<int, Input::VR_BUTTON> getEventVrDeviceButtonDown() const#

event triggered when a VR device button is pressed. If the button has not previously been touched, EventVrDeviceButtonTouchDown is triggered along with this event. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections vrdevicebuttondown_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventVrDeviceButtonDown().connect(vrdevicebuttondown_event_connections, vrdevicebuttondown_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventVrDeviceButtonDown().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection vrdevicebuttondown_event_connection;

// subscribe for the VrDeviceButtonDown event with a handler function keeping the connection
Input::getEventVrDeviceButtonDown().connect(vrdevicebuttondown_event_connection, vrdevicebuttondown_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
vrdevicebuttondown_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
vrdevicebuttondown_event_connection.setEnabled(true);

// ...

// remove subscription for the VrDeviceButtonDown event via the connection
vrdevicebuttondown_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A VrDeviceButtonDown event handler implemented as a class member
	void event_handler(int device_id,  Input::VR_BUTTON button)
	{
		Log::message("\Handling VrDeviceButtonDown event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventVrDeviceButtonDown().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the VrDeviceButtonDown event with a handler function
Input::getEventVrDeviceButtonDown().connect(vrdevicebuttondown_event_handler);


// remove subscription for the VrDeviceButtonDown event later by the handler function
Input::getEventVrDeviceButtonDown().disconnect(vrdevicebuttondown_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId vrdevicebuttondown_handler_id;

// subscribe for the VrDeviceButtonDown event with a lambda handler function and keeping connection ID
vrdevicebuttondown_handler_id = Input::getEventVrDeviceButtonDown().connect([](int device_id,  Input::VR_BUTTON button) { 
		Log::message("\Handling VrDeviceButtonDown event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventVrDeviceButtonDown().disconnect(vrdevicebuttondown_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all VrDeviceButtonDown events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventVrDeviceButtonDown().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventVrDeviceButtonDown().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(int device_id, Input::VR_BUTTON button)

Return value

Current

Event<int> getEventVrDeviceDisconnected() const#

event triggered when a VR device is disconnected. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the VrDeviceDisconnected event handler
void vrdevicedisconnected_event_handler(device_id)
{
	Log::message("\Handling VrDeviceDisconnected event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections vrdevicedisconnected_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventVrDeviceDisconnected().connect(vrdevicedisconnected_event_connections, vrdevicedisconnected_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventVrDeviceDisconnected().connect(vrdevicedisconnected_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection vrdevicedisconnected_event_connection;

// subscribe for the VrDeviceDisconnected event with a handler function keeping the connection
Input::getEventVrDeviceDisconnected().connect(vrdevicedisconnected_event_connection, vrdevicedisconnected_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
vrdevicedisconnected_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
vrdevicedisconnected_event_connection.setEnabled(true);

// ...

// remove subscription for the VrDeviceDisconnected event via the connection
vrdevicedisconnected_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A VrDeviceDisconnected event handler implemented as a class member
	void event_handler(device_id)
	{
		Log::message("\Handling VrDeviceDisconnected event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventVrDeviceDisconnected().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the VrDeviceDisconnected event with a handler function
Input::getEventVrDeviceDisconnected().connect(vrdevicedisconnected_event_handler);


// remove subscription for the VrDeviceDisconnected event later by the handler function
Input::getEventVrDeviceDisconnected().disconnect(vrdevicedisconnected_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId vrdevicedisconnected_handler_id;

// subscribe for the VrDeviceDisconnected event with a lambda handler function and keeping connection ID
vrdevicedisconnected_handler_id = Input::getEventVrDeviceDisconnected().connect([](device_id) { 
		Log::message("\Handling VrDeviceDisconnected event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventVrDeviceDisconnected().disconnect(vrdevicedisconnected_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all VrDeviceDisconnected events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventVrDeviceDisconnected().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventVrDeviceDisconnected().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(device_id)

Return value

Current

Event<int> getEventVrDeviceConnected() const#

event triggered when a VR device is connected. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the VrDeviceConnected event handler
void vrdeviceconnected_event_handler(device_id)
{
	Log::message("\Handling VrDeviceConnected event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections vrdeviceconnected_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventVrDeviceConnected().connect(vrdeviceconnected_event_connections, vrdeviceconnected_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventVrDeviceConnected().connect(vrdeviceconnected_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection vrdeviceconnected_event_connection;

// subscribe for the VrDeviceConnected event with a handler function keeping the connection
Input::getEventVrDeviceConnected().connect(vrdeviceconnected_event_connection, vrdeviceconnected_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
vrdeviceconnected_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
vrdeviceconnected_event_connection.setEnabled(true);

// ...

// remove subscription for the VrDeviceConnected event via the connection
vrdeviceconnected_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A VrDeviceConnected event handler implemented as a class member
	void event_handler(device_id)
	{
		Log::message("\Handling VrDeviceConnected event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventVrDeviceConnected().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the VrDeviceConnected event with a handler function
Input::getEventVrDeviceConnected().connect(vrdeviceconnected_event_handler);


// remove subscription for the VrDeviceConnected event later by the handler function
Input::getEventVrDeviceConnected().disconnect(vrdeviceconnected_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId vrdeviceconnected_handler_id;

// subscribe for the VrDeviceConnected event with a lambda handler function and keeping connection ID
vrdeviceconnected_handler_id = Input::getEventVrDeviceConnected().connect([](device_id) { 
		Log::message("\Handling VrDeviceConnected event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventVrDeviceConnected().disconnect(vrdeviceconnected_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all VrDeviceConnected events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventVrDeviceConnected().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventVrDeviceConnected().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(device_id)

Return value

Current

Event<int, int, int> getEventGamepadTouchMotion() const#

event triggered when the finger touching the gamepad touch panel moves across it. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the GamepadTouchMotion event handler
void gamepadtouchmotion_event_handler(gamepad_id)
{
	Log::message("\Handling GamepadTouchMotion event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections gamepadtouchmotion_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventGamepadTouchMotion().connect(gamepadtouchmotion_event_connections, gamepadtouchmotion_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventGamepadTouchMotion().connect(gamepadtouchmotion_event_connections, [](gamepad_id) { 
		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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection gamepadtouchmotion_event_connection;

// subscribe for the GamepadTouchMotion event with a handler function keeping the connection
Input::getEventGamepadTouchMotion().connect(gamepadtouchmotion_event_connection, gamepadtouchmotion_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
gamepadtouchmotion_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
gamepadtouchmotion_event_connection.setEnabled(true);

// ...

// remove subscription for the GamepadTouchMotion event via the connection
gamepadtouchmotion_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A GamepadTouchMotion event handler implemented as a class member
	void event_handler(gamepad_id)
	{
		Log::message("\Handling GamepadTouchMotion event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventGamepadTouchMotion().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the GamepadTouchMotion event with a handler function
Input::getEventGamepadTouchMotion().connect(gamepadtouchmotion_event_handler);


// remove subscription for the GamepadTouchMotion event later by the handler function
Input::getEventGamepadTouchMotion().disconnect(gamepadtouchmotion_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId gamepadtouchmotion_handler_id;

// subscribe for the GamepadTouchMotion event with a lambda handler function and keeping connection ID
gamepadtouchmotion_handler_id = Input::getEventGamepadTouchMotion().connect([](gamepad_id) { 
		Log::message("\Handling GamepadTouchMotion event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventGamepadTouchMotion().disconnect(gamepadtouchmotion_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all GamepadTouchMotion events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventGamepadTouchMotion().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventGamepadTouchMotion().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(gamepad_id)

Return value

Current

Event<int, int, int> getEventGamepadTouchUp() const#

event triggered when the touch is withdrawn from the gamepad touch panel. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the GamepadTouchUp event handler
void gamepadtouchup_event_handler(gamepad_id)
{
	Log::message("\Handling GamepadTouchUp event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections gamepadtouchup_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventGamepadTouchUp().connect(gamepadtouchup_event_connections, gamepadtouchup_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventGamepadTouchUp().connect(gamepadtouchup_event_connections, [](gamepad_id) { 
		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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection gamepadtouchup_event_connection;

// subscribe for the GamepadTouchUp event with a handler function keeping the connection
Input::getEventGamepadTouchUp().connect(gamepadtouchup_event_connection, gamepadtouchup_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
gamepadtouchup_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
gamepadtouchup_event_connection.setEnabled(true);

// ...

// remove subscription for the GamepadTouchUp event via the connection
gamepadtouchup_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A GamepadTouchUp event handler implemented as a class member
	void event_handler(gamepad_id)
	{
		Log::message("\Handling GamepadTouchUp event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventGamepadTouchUp().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the GamepadTouchUp event with a handler function
Input::getEventGamepadTouchUp().connect(gamepadtouchup_event_handler);


// remove subscription for the GamepadTouchUp event later by the handler function
Input::getEventGamepadTouchUp().disconnect(gamepadtouchup_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId gamepadtouchup_handler_id;

// subscribe for the GamepadTouchUp event with a lambda handler function and keeping connection ID
gamepadtouchup_handler_id = Input::getEventGamepadTouchUp().connect([](gamepad_id) { 
		Log::message("\Handling GamepadTouchUp event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventGamepadTouchUp().disconnect(gamepadtouchup_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all GamepadTouchUp events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventGamepadTouchUp().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventGamepadTouchUp().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(gamepad_id)

Return value

Current

Event<int, int, int> getEventGamepadTouchDown() const#

event triggered when the gamepad touch panel is touched. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the GamepadTouchDown event handler
void gamepadtouchdown_event_handler(gamepad_id)
{
	Log::message("\Handling GamepadTouchDown event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections gamepadtouchdown_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventGamepadTouchDown().connect(gamepadtouchdown_event_connections, gamepadtouchdown_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventGamepadTouchDown().connect(gamepadtouchdown_event_connections, [](gamepad_id) { 
		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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection gamepadtouchdown_event_connection;

// subscribe for the GamepadTouchDown event with a handler function keeping the connection
Input::getEventGamepadTouchDown().connect(gamepadtouchdown_event_connection, gamepadtouchdown_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
gamepadtouchdown_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
gamepadtouchdown_event_connection.setEnabled(true);

// ...

// remove subscription for the GamepadTouchDown event via the connection
gamepadtouchdown_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A GamepadTouchDown event handler implemented as a class member
	void event_handler(gamepad_id)
	{
		Log::message("\Handling GamepadTouchDown event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventGamepadTouchDown().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the GamepadTouchDown event with a handler function
Input::getEventGamepadTouchDown().connect(gamepadtouchdown_event_handler);


// remove subscription for the GamepadTouchDown event later by the handler function
Input::getEventGamepadTouchDown().disconnect(gamepadtouchdown_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId gamepadtouchdown_handler_id;

// subscribe for the GamepadTouchDown event with a lambda handler function and keeping connection ID
gamepadtouchdown_handler_id = Input::getEventGamepadTouchDown().connect([](gamepad_id) { 
		Log::message("\Handling GamepadTouchDown event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventGamepadTouchDown().disconnect(gamepadtouchdown_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all GamepadTouchDown events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventGamepadTouchDown().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventGamepadTouchDown().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(gamepad_id)

Return value

Current

Event<int, Input::GAMEPAD_AXIS> getEventGamepadAxisMotion() const#

event triggered when a gamepad axis state value is changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections gamepadaxismotion_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventGamepadAxisMotion().connect(gamepadaxismotion_event_connections, gamepadaxismotion_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventGamepadAxisMotion().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection gamepadaxismotion_event_connection;

// subscribe for the GamepadAxisMotion event with a handler function keeping the connection
Input::getEventGamepadAxisMotion().connect(gamepadaxismotion_event_connection, gamepadaxismotion_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
gamepadaxismotion_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
gamepadaxismotion_event_connection.setEnabled(true);

// ...

// remove subscription for the GamepadAxisMotion event via the connection
gamepadaxismotion_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A GamepadAxisMotion event handler implemented as a class member
	void event_handler(int gamepad_id,  Input::GAMEPAD_AXIS axis)
	{
		Log::message("\Handling GamepadAxisMotion event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventGamepadAxisMotion().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the GamepadAxisMotion event with a handler function
Input::getEventGamepadAxisMotion().connect(gamepadaxismotion_event_handler);


// remove subscription for the GamepadAxisMotion event later by the handler function
Input::getEventGamepadAxisMotion().disconnect(gamepadaxismotion_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId gamepadaxismotion_handler_id;

// subscribe for the GamepadAxisMotion event with a lambda handler function and keeping connection ID
gamepadaxismotion_handler_id = Input::getEventGamepadAxisMotion().connect([](int gamepad_id,  Input::GAMEPAD_AXIS axis) { 
		Log::message("\Handling GamepadAxisMotion event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventGamepadAxisMotion().disconnect(gamepadaxismotion_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all GamepadAxisMotion events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventGamepadAxisMotion().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventGamepadAxisMotion().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(int gamepad_id, Input::GAMEPAD_AXIS axis)

Return value

Current

Event<int, Input::GAMEPAD_BUTTON> getEventGamepadButtonUp() const#

event triggered when a gamepad button is released. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections gamepadbuttonup_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventGamepadButtonUp().connect(gamepadbuttonup_event_connections, gamepadbuttonup_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventGamepadButtonUp().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection gamepadbuttonup_event_connection;

// subscribe for the GamepadButtonUp event with a handler function keeping the connection
Input::getEventGamepadButtonUp().connect(gamepadbuttonup_event_connection, gamepadbuttonup_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
gamepadbuttonup_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
gamepadbuttonup_event_connection.setEnabled(true);

// ...

// remove subscription for the GamepadButtonUp event via the connection
gamepadbuttonup_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A GamepadButtonUp event handler implemented as a class member
	void event_handler(int gamepad_id,  Input::GAMEPAD_BUTTON button)
	{
		Log::message("\Handling GamepadButtonUp event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventGamepadButtonUp().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the GamepadButtonUp event with a handler function
Input::getEventGamepadButtonUp().connect(gamepadbuttonup_event_handler);


// remove subscription for the GamepadButtonUp event later by the handler function
Input::getEventGamepadButtonUp().disconnect(gamepadbuttonup_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId gamepadbuttonup_handler_id;

// subscribe for the GamepadButtonUp event with a lambda handler function and keeping connection ID
gamepadbuttonup_handler_id = Input::getEventGamepadButtonUp().connect([](int gamepad_id,  Input::GAMEPAD_BUTTON button) { 
		Log::message("\Handling GamepadButtonUp event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventGamepadButtonUp().disconnect(gamepadbuttonup_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all GamepadButtonUp events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventGamepadButtonUp().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventGamepadButtonUp().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(int gamepad_id, Input::GAMEPAD_BUTTON button)

Return value

Current

Event<int, Input::GAMEPAD_BUTTON> getEventGamepadButtonDown() const#

event triggered when a gamepad button is pressed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections gamepadbuttondown_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventGamepadButtonDown().connect(gamepadbuttondown_event_connections, gamepadbuttondown_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventGamepadButtonDown().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection gamepadbuttondown_event_connection;

// subscribe for the GamepadButtonDown event with a handler function keeping the connection
Input::getEventGamepadButtonDown().connect(gamepadbuttondown_event_connection, gamepadbuttondown_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
gamepadbuttondown_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
gamepadbuttondown_event_connection.setEnabled(true);

// ...

// remove subscription for the GamepadButtonDown event via the connection
gamepadbuttondown_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A GamepadButtonDown event handler implemented as a class member
	void event_handler(int gamepad_id,  Input::GAMEPAD_BUTTON button)
	{
		Log::message("\Handling GamepadButtonDown event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventGamepadButtonDown().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the GamepadButtonDown event with a handler function
Input::getEventGamepadButtonDown().connect(gamepadbuttondown_event_handler);


// remove subscription for the GamepadButtonDown event later by the handler function
Input::getEventGamepadButtonDown().disconnect(gamepadbuttondown_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId gamepadbuttondown_handler_id;

// subscribe for the GamepadButtonDown event with a lambda handler function and keeping connection ID
gamepadbuttondown_handler_id = Input::getEventGamepadButtonDown().connect([](int gamepad_id,  Input::GAMEPAD_BUTTON button) { 
		Log::message("\Handling GamepadButtonDown event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventGamepadButtonDown().disconnect(gamepadbuttondown_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all GamepadButtonDown events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventGamepadButtonDown().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventGamepadButtonDown().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(int gamepad_id, Input::GAMEPAD_BUTTON button)

Return value

Current

Event<int> getEventGamepadDisconnected() const#

event triggered when a gamepad is disconnected. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the GamepadDisconnected event handler
void gamepaddisconnected_event_handler(gamepad_id)
{
	Log::message("\Handling GamepadDisconnected event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections gamepaddisconnected_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventGamepadDisconnected().connect(gamepaddisconnected_event_connections, gamepaddisconnected_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventGamepadDisconnected().connect(gamepaddisconnected_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection gamepaddisconnected_event_connection;

// subscribe for the GamepadDisconnected event with a handler function keeping the connection
Input::getEventGamepadDisconnected().connect(gamepaddisconnected_event_connection, gamepaddisconnected_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
gamepaddisconnected_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
gamepaddisconnected_event_connection.setEnabled(true);

// ...

// remove subscription for the GamepadDisconnected event via the connection
gamepaddisconnected_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A GamepadDisconnected event handler implemented as a class member
	void event_handler(gamepad_id)
	{
		Log::message("\Handling GamepadDisconnected event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventGamepadDisconnected().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the GamepadDisconnected event with a handler function
Input::getEventGamepadDisconnected().connect(gamepaddisconnected_event_handler);


// remove subscription for the GamepadDisconnected event later by the handler function
Input::getEventGamepadDisconnected().disconnect(gamepaddisconnected_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId gamepaddisconnected_handler_id;

// subscribe for the GamepadDisconnected event with a lambda handler function and keeping connection ID
gamepaddisconnected_handler_id = Input::getEventGamepadDisconnected().connect([](gamepad_id) { 
		Log::message("\Handling GamepadDisconnected event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventGamepadDisconnected().disconnect(gamepaddisconnected_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all GamepadDisconnected events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventGamepadDisconnected().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventGamepadDisconnected().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(gamepad_id)

Return value

Current

Event<int> getEventGamepadConnected() const#

event triggered when a gamepad is connected. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the GamepadConnected event handler
void gamepadconnected_event_handler(gamepad_id)
{
	Log::message("\Handling GamepadConnected event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections gamepadconnected_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventGamepadConnected().connect(gamepadconnected_event_connections, gamepadconnected_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventGamepadConnected().connect(gamepadconnected_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection gamepadconnected_event_connection;

// subscribe for the GamepadConnected event with a handler function keeping the connection
Input::getEventGamepadConnected().connect(gamepadconnected_event_connection, gamepadconnected_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
gamepadconnected_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
gamepadconnected_event_connection.setEnabled(true);

// ...

// remove subscription for the GamepadConnected event via the connection
gamepadconnected_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A GamepadConnected event handler implemented as a class member
	void event_handler(gamepad_id)
	{
		Log::message("\Handling GamepadConnected event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventGamepadConnected().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the GamepadConnected event with a handler function
Input::getEventGamepadConnected().connect(gamepadconnected_event_handler);


// remove subscription for the GamepadConnected event later by the handler function
Input::getEventGamepadConnected().disconnect(gamepadconnected_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId gamepadconnected_handler_id;

// subscribe for the GamepadConnected event with a lambda handler function and keeping connection ID
gamepadconnected_handler_id = Input::getEventGamepadConnected().connect([](gamepad_id) { 
		Log::message("\Handling GamepadConnected event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventGamepadConnected().disconnect(gamepadconnected_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all GamepadConnected events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventGamepadConnected().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventGamepadConnected().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(gamepad_id)

Return value

Current

Event<int> getEventTouchMotion() const#

event triggered when the touch is moved. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the TouchMotion event handler
void touchmotion_event_handler(touch_id)
{
	Log::message("\Handling TouchMotion event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections touchmotion_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventTouchMotion().connect(touchmotion_event_connections, touchmotion_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventTouchMotion().connect(touchmotion_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection touchmotion_event_connection;

// subscribe for the TouchMotion event with a handler function keeping the connection
Input::getEventTouchMotion().connect(touchmotion_event_connection, touchmotion_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
touchmotion_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
touchmotion_event_connection.setEnabled(true);

// ...

// remove subscription for the TouchMotion event via the connection
touchmotion_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A TouchMotion event handler implemented as a class member
	void event_handler(touch_id)
	{
		Log::message("\Handling TouchMotion event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventTouchMotion().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the TouchMotion event with a handler function
Input::getEventTouchMotion().connect(touchmotion_event_handler);


// remove subscription for the TouchMotion event later by the handler function
Input::getEventTouchMotion().disconnect(touchmotion_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId touchmotion_handler_id;

// subscribe for the TouchMotion event with a lambda handler function and keeping connection ID
touchmotion_handler_id = Input::getEventTouchMotion().connect([](touch_id) { 
		Log::message("\Handling TouchMotion event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventTouchMotion().disconnect(touchmotion_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all TouchMotion events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventTouchMotion().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventTouchMotion().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(touch_id)

Return value

Current

Event<int> getEventTouchUp() const#

event triggered when the touch is released. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the TouchUp event handler
void touchup_event_handler(touch_id)
{
	Log::message("\Handling TouchUp event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections touchup_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventTouchUp().connect(touchup_event_connections, touchup_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventTouchUp().connect(touchup_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection touchup_event_connection;

// subscribe for the TouchUp event with a handler function keeping the connection
Input::getEventTouchUp().connect(touchup_event_connection, touchup_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
touchup_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
touchup_event_connection.setEnabled(true);

// ...

// remove subscription for the TouchUp event via the connection
touchup_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A TouchUp event handler implemented as a class member
	void event_handler(touch_id)
	{
		Log::message("\Handling TouchUp event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventTouchUp().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the TouchUp event with a handler function
Input::getEventTouchUp().connect(touchup_event_handler);


// remove subscription for the TouchUp event later by the handler function
Input::getEventTouchUp().disconnect(touchup_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId touchup_handler_id;

// subscribe for the TouchUp event with a lambda handler function and keeping connection ID
touchup_handler_id = Input::getEventTouchUp().connect([](touch_id) { 
		Log::message("\Handling TouchUp event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventTouchUp().disconnect(touchup_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all TouchUp events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventTouchUp().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventTouchUp().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(touch_id)

Return value

Current

Event<int> getEventTouchDown() const#

event triggered when the touch is pressed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the TouchDown event handler
void touchdown_event_handler(touch_id)
{
	Log::message("\Handling TouchDown event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections touchdown_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventTouchDown().connect(touchdown_event_connections, touchdown_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventTouchDown().connect(touchdown_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection touchdown_event_connection;

// subscribe for the TouchDown event with a handler function keeping the connection
Input::getEventTouchDown().connect(touchdown_event_connection, touchdown_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
touchdown_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
touchdown_event_connection.setEnabled(true);

// ...

// remove subscription for the TouchDown event via the connection
touchdown_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A TouchDown event handler implemented as a class member
	void event_handler(touch_id)
	{
		Log::message("\Handling TouchDown event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventTouchDown().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the TouchDown event with a handler function
Input::getEventTouchDown().connect(touchdown_event_handler);


// remove subscription for the TouchDown event later by the handler function
Input::getEventTouchDown().disconnect(touchdown_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId touchdown_handler_id;

// subscribe for the TouchDown event with a lambda handler function and keeping connection ID
touchdown_handler_id = Input::getEventTouchDown().connect([](touch_id) { 
		Log::message("\Handling TouchDown event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventTouchDown().disconnect(touchdown_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all TouchDown events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventTouchDown().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventTouchDown().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(touch_id)

Return value

Current

Event<unsigned int> getEventTextPress() const#

event triggered when the key that has a corresponding printable symbol is pressed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the TextPress event handler
void textpress_event_handler(unsigned int unicode)
{
	Log::message("\Handling TextPress event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections textpress_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventTextPress().connect(textpress_event_connections, textpress_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventTextPress().connect(textpress_event_connections, [](unsigned int 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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection textpress_event_connection;

// subscribe for the TextPress event with a handler function keeping the connection
Input::getEventTextPress().connect(textpress_event_connection, textpress_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
textpress_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
textpress_event_connection.setEnabled(true);

// ...

// remove subscription for the TextPress event via the connection
textpress_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A TextPress event handler implemented as a class member
	void event_handler(unsigned int unicode)
	{
		Log::message("\Handling TextPress event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventTextPress().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the TextPress event with a handler function
Input::getEventTextPress().connect(textpress_event_handler);


// remove subscription for the TextPress event later by the handler function
Input::getEventTextPress().disconnect(textpress_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId textpress_handler_id;

// subscribe for the TextPress event with a lambda handler function and keeping connection ID
textpress_handler_id = Input::getEventTextPress().connect([](unsigned int unicode) { 
		Log::message("\Handling TextPress event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventTextPress().disconnect(textpress_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all TextPress events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventTextPress().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventTextPress().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(unsigned int unicode)

Return value

Current

Event<unsigned int> getEventKeyRepeat() const#

event triggered when the key is pressed repeatedly. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the KeyRepeat event handler
void keyrepeat_event_handler(unsigned int unicode)
{
	Log::message("\Handling KeyRepeat event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections keyrepeat_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventKeyRepeat().connect(keyrepeat_event_connections, keyrepeat_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventKeyRepeat().connect(keyrepeat_event_connections, [](unsigned int 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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection keyrepeat_event_connection;

// subscribe for the KeyRepeat event with a handler function keeping the connection
Input::getEventKeyRepeat().connect(keyrepeat_event_connection, keyrepeat_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
keyrepeat_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
keyrepeat_event_connection.setEnabled(true);

// ...

// remove subscription for the KeyRepeat event via the connection
keyrepeat_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A KeyRepeat event handler implemented as a class member
	void event_handler(unsigned int unicode)
	{
		Log::message("\Handling KeyRepeat event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventKeyRepeat().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the KeyRepeat event with a handler function
Input::getEventKeyRepeat().connect(keyrepeat_event_handler);


// remove subscription for the KeyRepeat event later by the handler function
Input::getEventKeyRepeat().disconnect(keyrepeat_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId keyrepeat_handler_id;

// subscribe for the KeyRepeat event with a lambda handler function and keeping connection ID
keyrepeat_handler_id = Input::getEventKeyRepeat().connect([](unsigned int unicode) { 
		Log::message("\Handling KeyRepeat event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventKeyRepeat().disconnect(keyrepeat_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all KeyRepeat events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventKeyRepeat().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventKeyRepeat().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(unsigned int unicode)

Return value

Current

Event<Input::KEY> getEventKeyUp() const#

event triggered when the key is released. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections keyup_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventKeyUp().connect(keyup_event_connections, keyup_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventKeyUp().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection keyup_event_connection;

// subscribe for the KeyUp event with a handler function keeping the connection
Input::getEventKeyUp().connect(keyup_event_connection, keyup_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
keyup_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
keyup_event_connection.setEnabled(true);

// ...

// remove subscription for the KeyUp event via the connection
keyup_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A KeyUp event handler implemented as a class member
	void event_handler(Input::KEY key)
	{
		Log::message("\Handling KeyUp event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventKeyUp().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the KeyUp event with a handler function
Input::getEventKeyUp().connect(keyup_event_handler);


// remove subscription for the KeyUp event later by the handler function
Input::getEventKeyUp().disconnect(keyup_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId keyup_handler_id;

// subscribe for the KeyUp event with a lambda handler function and keeping connection ID
keyup_handler_id = Input::getEventKeyUp().connect([](Input::KEY key) { 
		Log::message("\Handling KeyUp event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventKeyUp().disconnect(keyup_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all KeyUp events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventKeyUp().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventKeyUp().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(Input::KEY key)

Return value

Current

Event<Input::KEY> getEventKeyDown() const#

event triggered when the key is pressed and held. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections keydown_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventKeyDown().connect(keydown_event_connections, keydown_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventKeyDown().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection keydown_event_connection;

// subscribe for the KeyDown event with a handler function keeping the connection
Input::getEventKeyDown().connect(keydown_event_connection, keydown_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
keydown_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
keydown_event_connection.setEnabled(true);

// ...

// remove subscription for the KeyDown event via the connection
keydown_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A KeyDown event handler implemented as a class member
	void event_handler(Input::KEY key)
	{
		Log::message("\Handling KeyDown event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventKeyDown().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the KeyDown event with a handler function
Input::getEventKeyDown().connect(keydown_event_handler);


// remove subscription for the KeyDown event later by the handler function
Input::getEventKeyDown().disconnect(keydown_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId keydown_handler_id;

// subscribe for the KeyDown event with a lambda handler function and keeping connection ID
keydown_handler_id = Input::getEventKeyDown().connect([](Input::KEY key) { 
		Log::message("\Handling KeyDown event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventKeyDown().disconnect(keydown_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all KeyDown events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventKeyDown().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventKeyDown().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(Input::KEY key)

Return value

Current

Event<int, int> getEventMouseMotion() const#

event triggered when the mouse is moved. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the MouseMotion event handler
void mousemotion_event_handler(coord_x)
{
	Log::message("\Handling MouseMotion event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections mousemotion_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventMouseMotion().connect(mousemotion_event_connections, mousemotion_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventMouseMotion().connect(mousemotion_event_connections, [](coord_x) { 
		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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection mousemotion_event_connection;

// subscribe for the MouseMotion event with a handler function keeping the connection
Input::getEventMouseMotion().connect(mousemotion_event_connection, mousemotion_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
mousemotion_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
mousemotion_event_connection.setEnabled(true);

// ...

// remove subscription for the MouseMotion event via the connection
mousemotion_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A MouseMotion event handler implemented as a class member
	void event_handler(coord_x)
	{
		Log::message("\Handling MouseMotion event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventMouseMotion().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the MouseMotion event with a handler function
Input::getEventMouseMotion().connect(mousemotion_event_handler);


// remove subscription for the MouseMotion event later by the handler function
Input::getEventMouseMotion().disconnect(mousemotion_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId mousemotion_handler_id;

// subscribe for the MouseMotion event with a lambda handler function and keeping connection ID
mousemotion_handler_id = Input::getEventMouseMotion().connect([](coord_x) { 
		Log::message("\Handling MouseMotion event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventMouseMotion().disconnect(mousemotion_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all MouseMotion events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventMouseMotion().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventMouseMotion().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(coord_x)

Return value

Current

Event<int> getEventMouseWheelHorizontal() const#

event triggered when the mouse wheel is moved horizontally. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the MouseWheelHorizontal event handler
void mousewheelhorizontal_event_handler(delta_horizontal)
{
	Log::message("\Handling MouseWheelHorizontal event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections mousewheelhorizontal_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventMouseWheelHorizontal().connect(mousewheelhorizontal_event_connections, mousewheelhorizontal_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventMouseWheelHorizontal().connect(mousewheelhorizontal_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection mousewheelhorizontal_event_connection;

// subscribe for the MouseWheelHorizontal event with a handler function keeping the connection
Input::getEventMouseWheelHorizontal().connect(mousewheelhorizontal_event_connection, mousewheelhorizontal_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
mousewheelhorizontal_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
mousewheelhorizontal_event_connection.setEnabled(true);

// ...

// remove subscription for the MouseWheelHorizontal event via the connection
mousewheelhorizontal_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A MouseWheelHorizontal event handler implemented as a class member
	void event_handler(delta_horizontal)
	{
		Log::message("\Handling MouseWheelHorizontal event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventMouseWheelHorizontal().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the MouseWheelHorizontal event with a handler function
Input::getEventMouseWheelHorizontal().connect(mousewheelhorizontal_event_handler);


// remove subscription for the MouseWheelHorizontal event later by the handler function
Input::getEventMouseWheelHorizontal().disconnect(mousewheelhorizontal_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId mousewheelhorizontal_handler_id;

// subscribe for the MouseWheelHorizontal event with a lambda handler function and keeping connection ID
mousewheelhorizontal_handler_id = Input::getEventMouseWheelHorizontal().connect([](delta_horizontal) { 
		Log::message("\Handling MouseWheelHorizontal event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventMouseWheelHorizontal().disconnect(mousewheelhorizontal_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all MouseWheelHorizontal events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventMouseWheelHorizontal().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventMouseWheelHorizontal().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(delta_horizontal)

Return value

Current

Event<int> getEventMouseWheel() const#

event triggered when the mouse scroll wheel is moved. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// implement the MouseWheel event handler
void mousewheel_event_handler(delta_vertical)
{
	Log::message("\Handling MouseWheel event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections mousewheel_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventMouseWheel().connect(mousewheel_event_connections, mousewheel_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventMouseWheel().connect(mousewheel_event_connections, [](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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection mousewheel_event_connection;

// subscribe for the MouseWheel event with a handler function keeping the connection
Input::getEventMouseWheel().connect(mousewheel_event_connection, mousewheel_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
mousewheel_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
mousewheel_event_connection.setEnabled(true);

// ...

// remove subscription for the MouseWheel event via the connection
mousewheel_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A MouseWheel event handler implemented as a class member
	void event_handler(delta_vertical)
	{
		Log::message("\Handling MouseWheel event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventMouseWheel().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the MouseWheel event with a handler function
Input::getEventMouseWheel().connect(mousewheel_event_handler);


// remove subscription for the MouseWheel event later by the handler function
Input::getEventMouseWheel().disconnect(mousewheel_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId mousewheel_handler_id;

// subscribe for the MouseWheel event with a lambda handler function and keeping connection ID
mousewheel_handler_id = Input::getEventMouseWheel().connect([](delta_vertical) { 
		Log::message("\Handling MouseWheel event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventMouseWheel().disconnect(mousewheel_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all MouseWheel events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventMouseWheel().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventMouseWheel().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(delta_vertical)

Return value

Current

Event<Input::MOUSE_BUTTON> getEventMouseUp() const#

event triggered when the mouse button is released. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections mouseup_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventMouseUp().connect(mouseup_event_connections, mouseup_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventMouseUp().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection mouseup_event_connection;

// subscribe for the MouseUp event with a handler function keeping the connection
Input::getEventMouseUp().connect(mouseup_event_connection, mouseup_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
mouseup_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
mouseup_event_connection.setEnabled(true);

// ...

// remove subscription for the MouseUp event via the connection
mouseup_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A MouseUp event handler implemented as a class member
	void event_handler(Input::MOUSE_BUTTON button)
	{
		Log::message("\Handling MouseUp event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventMouseUp().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the MouseUp event with a handler function
Input::getEventMouseUp().connect(mouseup_event_handler);


// remove subscription for the MouseUp event later by the handler function
Input::getEventMouseUp().disconnect(mouseup_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId mouseup_handler_id;

// subscribe for the MouseUp event with a lambda handler function and keeping connection ID
mouseup_handler_id = Input::getEventMouseUp().connect([](Input::MOUSE_BUTTON button) { 
		Log::message("\Handling MouseUp event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventMouseUp().disconnect(mouseup_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all MouseUp events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventMouseUp().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventMouseUp().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(Input::MOUSE_BUTTON button)

Return value

Current

Event<Input::MOUSE_BUTTON> getEventMouseDown() const#

event triggered when the mouse button is pressed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).

Usage Example

Source code (C++)
// 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 instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections mousedown_event_connections;

// link to this instance when subscribing for an event (subscription for various events can be linked)
Input::getEventMouseDown().connect(mousedown_event_connections, mousedown_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
Input::getEventMouseDown().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 an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection mousedown_event_connection;

// subscribe for the MouseDown event with a handler function keeping the connection
Input::getEventMouseDown().connect(mousedown_event_connection, mousedown_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
mousedown_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
mousedown_event_connection.setEnabled(true);

// ...

// remove subscription for the MouseDown event via the connection
mousedown_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A MouseDown event handler implemented as a class member
	void event_handler(Input::MOUSE_BUTTON button)
	{
		Log::message("\Handling MouseDown event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
Input::getEventMouseDown().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe for the MouseDown event with a handler function
Input::getEventMouseDown().connect(mousedown_event_handler);


// remove subscription for the MouseDown event later by the handler function
Input::getEventMouseDown().disconnect(mousedown_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId mousedown_handler_id;

// subscribe for the MouseDown event with a lambda handler function and keeping connection ID
mousedown_handler_id = Input::getEventMouseDown().connect([](Input::MOUSE_BUTTON button) { 
		Log::message("\Handling MouseDown event (lambda).\n");
	}
);

// remove the subscription later using the ID
Input::getEventMouseDown().disconnect(mousedown_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all MouseDown events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
Input::getEventMouseDown().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
Input::getEventMouseDown().setEnabled(true);
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler(Input::MOUSE_BUTTON button)

Return value

Current

Math::ivec2 getMousePosition ( ) const#

Returns a vector containing the global coordinates of the mouse cursor. In case of a mouse button event, the cursor position at the moment of the processed event is returned. In case of no such event, the mouse position at the beginning of the frame is returned. To get the cursor position during another type of event, get this event (for example getKeyEvent()) and get the cursor position stored inside it.

Return value

Global coordinates of the cursor.

Math::ivec2 getMouseDeltaPosition ( ) const#

Returns a vector containing screen position change of the mouse pointer along the X and Y axes — the difference between the values in the previous and the current frames.

Return value

Float mouse pointer position delta.

int getMouseWheel ( ) const#

Returns the current mouse scroll value. Negative values correspond to scrolling downwards; positive values correspond to scrolling upwards; the value is zero when the mouse wheel is not scrolled.

Return value

Mouse scroll value in the [-1;1] range.

int getMouseWheelHorizontal ( ) const#

Returns the current horizontal mouse scroll value.

Return value

Horizontal mouse scroll value in the [-1;1] range.

void setMouseGrab ( bool grab ) #

Sets the value indicating if the mouse pointer is bound to the application window.

Arguments

  • bool grab - 1 if the mouse cannot leave the application window; otherwise, 0.

bool isMouseGrab ( ) const#

Returns the value indicating if the mouse pointer is bound to the application window.

Return value

true if the mouse cannot leave the application window; otherwise, false.

int getNumGamePads ( ) const#

Returns the total number of all gamepads.

Return value

Number of all gamepads.

Ptr<InputGamePad> getGamePad ( int num ) const#

Returns a gamepad of the given index.

Arguments

  • int num - Gamepad index.

Return value

InputGamepad object.

int getNumJoysticks ( ) const#

Returns the total number of all joysticks.

Return value

Number of all joysticks.

Ptr<InputJoystick> getJoystick ( int num ) const#

Returns a joystick with the given index.

Arguments

  • int num - Joystick index.

Return value

InputJoystick object.

bool isKeyPressed ( Input::KEY key ) const#

Returns a value indicating if the given key is pressed. Check this value to perform continuous actions.
Source code (C++)
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 ) const#

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.
Source code (C++)
if (Input::isKeyDown(Input::KEY_SPACE)) {
	Log::message("the Space key was pressed\n");
}

Arguments

Return value

1 during the first frame when the key was pressed, 0 for the following ones until it is released and pressed again.

bool isKeyUp ( Input::KEY key ) const#

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.
Source code (C++)
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 ) const#

Returns a value indicating if the given mouse button is pressed. Check this value to perform continuous actions.
Source code (C++)
if (Input::isMouseButtonPressed(Input::MOUSE_BUTTON_LEFT)) {
	Log::message("the left mouse button is held down\n");
}

Arguments

Return value

1 if the mouse button is pressed; otherwise, 0.

bool isMouseButtonDown ( Input::MOUSE_BUTTON button ) const#

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.
Source code (C++)
if (Input::isMouseButtonDown(Input::MOUSE_BUTTON_LEFT)) {
	Log::message("the left mouse button was pressed\n");
}

Arguments

Return value

1 during the first frame when the mouse button was released; otherwise, 0.

bool isMouseButtonUp ( Input::MOUSE_BUTTON button ) const#

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.
Source code (C++)
if (Input::isMouseButtonUp(Input::MOUSE_BUTTON_LEFT)) {
	Log::message("the left mouse button was released\n");
}

Arguments

Return value

1 during the first frame when the mouse button was released; otherwise, 0.

void setMouseHandle ( Input::MOUSE_HANDLE handle ) #

Sets the mouse behavior mode.

Arguments

Input::MOUSE_HANDLE getMouseHandle ( ) const#

Returns the mouse behavior mode.

Return value

Mouse behavior mode, one of the MOUSE_HANDLE_* values.

bool isTouchPressed ( int index ) const#

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 ) const#

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 ) const#

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.

Math::ivec2 getTouchPosition ( int index ) const#

Returns a vector containing integer values of touch position.

Arguments

  • int index - Touch input index.

Return value

The touch position.

Math::ivec2 getTouchDelta ( int index ) const#

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.

Ptr<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, Vector<Ptr<InputEventTouch>> & OUT_events ) #

Returns the actions cast to the touch event.

Arguments

  • int index - Touch input index.
  • Vector<Ptr<InputEventTouch>> & OUT_events - The buffer with touch input events.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.

Return value

Number of touch input events.

Ptr<InputEventKeyboard> getKeyEvent ( Input::KEY key ) #

Returns the currently processed keyboard input event.

Arguments

Return value

Keyboard input event, or nullptr if there are no events for the specified key in the current frame.

int getKeyEvents ( Input::KEY key, Vector<Ptr<InputEventKeyboard>> & OUT_events ) #

Returns the buffer with events for the specified key.

Arguments

  • Input::KEY key - One of the preset KEY_ codes.
  • Vector<Ptr<InputEventKeyboard>> & OUT_events - The buffer with input events.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.

const char * getKeyName ( Input::KEY key ) const#

Returns the specified key name.

Arguments

Return value

Key name.

Input::KEY getKeyByName ( const char * name ) const#

Returns the key by its name.

Arguments

  • const char * name - Key name.

Return value

One of the preset KEY_ codes.

Ptr<InputEventMouseButton> getMouseButtonEvent ( Input::MOUSE_BUTTON button ) #

Returns the mouse motion input event for the specified button.

Arguments

Return value

Mouse motion input event.

const char * getMouseButtonName ( Input::MOUSE_BUTTON button ) const#

Returns the mouse button name.

Arguments

Return value

Mouse button name.

Input::MOUSE_BUTTON getMouseButtonByName ( const char * name ) const#

Returns the mouse button by its name.

Arguments

  • const char * name - Mouse button name.

Return value

One of the preset MOUSE_BUTTON_ codes.

int getEventsBuffer ( int frame, Vector<Ptr<InputEvent>> & OUT_events ) const#

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.
  • Vector<Ptr<InputEvent>> & OUT_events - The buffer with input events.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.

void sendEvent ( const Ptr<InputEvent> & e ) #

Creates a user event and dispatches it to the Engine.

Arguments

void setEventsFilter ( int (*)(const Ptr<InputEvent> &) 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

bool isModifierEnabled ( Input::MODIFIER modifier ) const#

Returns the value indicating if the specified modifier is enabled.

Arguments

Return value

true if the modifier is enabled; otherwise, false.

unsigned int keyToUnicode ( Input::KEY key ) const#

Returns the specified key transformed to unicode.

Arguments

Return value

Unicode symbol.

Input::KEY unicodeToKey ( unsigned int unicode ) const#

Returns the specified key transformed to unicode.

Arguments

  • unsigned int unicode - Unicode symbol.

Return value

One of the preset KEY_ codes.

Math::ivec2 getMouseDeltaRaw ( ) const#

Returns the physical change in the absolute mouse position (not the screen cursor).

Return value

The change in the absolute mouse position, dots per inch.

bool isEmptyClipboard ( ) const#

Returns a value indicating if the clipboard is empty.

Return value

true if the clipboard is empty; otherwise, false.

void setClipboard ( const char * clipboard ) #

Updates the contents of the system clipboard.

Arguments

  • const char * clipboard - Contents to set.

const char * getClipboard ( ) const#

Retrieves the contents of the system clipboard.

Return value

Contents of the system clipboard.

void setMouseCursorHide ( bool hide ) #

Sets a value indicating if the mouse cursor should be hidden. Can be used, for example, to hide mouse cursor for a certain element.
Notice
This method hides the cursor only for one frame. So, you should call it each frame if a longer period is required.

Arguments

  • bool hide - true to hide the mouse cursor for a single frame, false - to show it.

bool isMouseCursorHide ( ) const#

Returns a value indicating if the mouse cursor is hidden in the current frame.

Return value

true if mouse cursor is hidden in the current frame, false - to show it.

void setMouseCursorSystem ( bool system ) #

Sets a value indicating if the OS mouse pointer should be displayed.

Arguments

  • bool system - true to display the OS mouse pointer; otherwise, false.

bool isMouseCursorSystem ( ) const#

Returns a value indicating if the OS mouse pointer is displayed.

Return value

true if the OS mouse pointer is displayed; otherwise, false.

void setMouseCursorNeedUpdate ( bool update ) #

Sets a value indicating that some changes were made to the cursor (e.g., it was shown, hidden, changed to system, etc.) and it has to be updated. Suppose the cursor was modified, for example, by the Interface plugin. After closing the plugin's window the cursor shall not return to its previous state because SDL doesn't even know about the changes. You can use this flag to signalize, that mouse cursor must be updated.

Arguments

  • bool update - true to signalize that the mouse cursor has to be updated; otherwise, false.

bool isMouseCursorNeedUpdate ( ) const#

Returns a value indicating that changes were made to the cursor (e.g., it was shown, hidden, changed to system, etc.) and it has to be updated. Suppose the cursor was modified, for example, by the Interface plugin. After closing the plugin's window the cursor shall not return to its previous state because SDL doesn't even know about the changes. You can use this flag to signalize, that mouse cursor must be updated.

Return value

true if the mouse cursor has to be updated; otherwise, false.

void setMouseCursorSkinCustom ( const Ptr<Image> & image ) #

Sets a custom image to be used for the mouse cursor.

Arguments

  • const Ptr<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 ( const Ptr<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.
Source code (C++)
// create an instance of the Image class
ImagePtr cursor = Image::create("textures/my_cursor.png");
// set the image as the mouse cursor
Input::setMouseCursorCustom(cursor);
// show the OS mouse pointer
Input::setMouseCursorSystem(1);

Arguments

  • const Ptr<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.

const char * getKeyLocalName ( Input::KEY key ) const#

Returns the name for the specified key taken from the currently selected keyboard layout.
Notice
The returned value is affected by the modifier such as Shift.

Arguments

Return value

Localized name for the specified key.

int getMouseButtonEvents ( Input::MOUSE_BUTTON button, Vector<Ptr<InputEventMouseButton>> & OUT_events ) #

Returns the number of input events for the specified mouse button and puts the events to the specified output buffer.

Arguments

Return value

Number of input events for the specified mouse button.

Math::ivec2 getForceMousePosition ( ) #

Returns the absolute mouse position obtained from the OS.

Return value

The absolute mouse position.

bool isKeyText ( Input::KEY key ) const#

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.

const char * getModifierName ( Input::MODIFIER modifier ) const#

Returns the name of the key modifier by its scancode.

Arguments

Return value

Key name of the modifier.

Input::MODIFIER getModifierByName ( const char * name ) const#

Returns the scancode of the key modifier by its name.

Arguments

  • const char * name - Key name of the modifier.

Return value

Scancode of the modifier.

int getNumVRDevices ( ) const#

Ptr<InputVRDevice> getVRDevice ( int num ) const#

Arguments

  • int num

Ptr<InputVRHead> getVRHead ( ) const#

Ptr<InputVRController> getVRControllerLeft ( ) const#

Ptr<InputVRController> getVRControllerRight ( ) const#

Ptr<InputVRController> getVRControllerTreadmill ( ) const#

Last update: 19.12.2023
Build: ()