libdonut  2.3.2
Application framework for cross-platform game development in C++20
Classes | Enumerations | Functions | Variables
donut::events Namespace Reference

Classes

struct  Error
 Exception type for domain-specific errors originating from the donut::events module. More...
 
struct  EventBase
 Event base. More...
 
struct  ApplicationEventBase
 Application Event base. More...
 
struct  WindowEventBase
 Window Event base. More...
 
struct  InputEventBase
 Input Event base. More...
 
struct  KeyEventBase
 Keyboard key Event base. More...
 
struct  TextInputEventBase
 Text input Event base. More...
 
struct  MouseEventBase
 Mouse Event base. More...
 
struct  MouseButtonEventBase
 Mouse button Event base. More...
 
struct  ControllerEventBase
 Controller Event base. More...
 
struct  ControllerAxisEventBase
 Controller axis Event base. More...
 
struct  ControllerButtonEventBase
 Controller button Event base. More...
 
struct  TouchEventBase
 Touch Event base. More...
 
struct  KeymapEventBase
 Keyboard keymap Event base. More...
 
struct  ClipboardEventBase
 Clipboard Event base. More...
 
struct  DropEventBase
 Drop Event base. More...
 
struct  ApplicationQuitRequestedEvent
 Application was requested to quit by the user. More...
 
struct  ApplicationTerminatingEvent
 Application is being terminated by the OS. More...
 
struct  ApplicationLowMemoryEvent
 Application is low on memory. More...
 
struct  ApplicationPausingEvent
 Application is about to be paused by the OS. More...
 
struct  ApplicationPausedEvent
 Application was paused by the OS. More...
 
struct  ApplicationUnpausingEvent
 Application is about to be unpaused by the OS. More...
 
struct  ApplicationUnpausedEvent
 Application was unpaused by the OS. More...
 
struct  WindowShownEvent
 Window was shown. More...
 
struct  WindowHiddenEvent
 Window was hidden. More...
 
struct  WindowExposedEvent
 Window was exposed. More...
 
struct  WindowMovedEvent
 Window was moved. More...
 
struct  WindowResizedEvent
 Window was resized manually. More...
 
struct  WindowSizeChangedEvent
 Window size was changed. More...
 
struct  WindowMinimizedEvent
 Window was minimized. More...
 
struct  WindowMaximizedEvent
 Window was maximized. More...
 
struct  WindowRestoredEvent
 Window was restored. More...
 
struct  WindowMouseFocusGainedEvent
 Window gained mouse focus. More...
 
struct  WindowMouseFocusLostEvent
 Window lost mouse focus. More...
 
struct  WindowKeyboardFocusGainedEvent
 Window gained keyboard focus. More...
 
struct  WindowKeyboardFocusLostEvent
 Window lost keyboard focus. More...
 
struct  WindowCloseRequestedEvent
 Window was requested to close. More...
 
struct  WindowDisplayChangedEvent
 Window was moved to a new display. More...
 
struct  KeyPressedEvent
 Keyboard key was pressed. More...
 
struct  KeyPressRepeatedEvent
 Keyboard key was held, causing a repeat press. More...
 
struct  KeyReleasedEvent
 Keyboard key was released. More...
 
struct  TextInputEditedEvent
 Text input was edited. More...
 
struct  TextInputSubmittedEvent
 Text input was submitted. More...
 
struct  MouseMovedEvent
 Mouse was moved. More...
 
struct  MouseButtonPressedEvent
 Mouse button was pressed. More...
 
struct  MouseButtonReleasedEvent
 Mouse button was released. More...
 
struct  MouseWheelScrolledEvent
 Mouse wheel was scrolled. More...
 
struct  ControllerAddedEvent
 Controller was added. More...
 
struct  ControllerRemovedEvent
 Controller was removed. More...
 
struct  ControllerRemappedEvent
 Controller was remapped. More...
 
struct  ControllerAxisMovedEvent
 Controller axis was moved. More...
 
struct  ControllerButtonPressedEvent
 Controller button was pressed. More...
 
struct  ControllerButtonReleasedEvent
 Controller button was released. More...
 
struct  TouchMovedEvent
 Touch was moved. More...
 
struct  TouchPressedEvent
 Touch was pressed. More...
 
struct  TouchReleasedEvent
 Touch was released. More...
 
struct  KeymapChangedEvent
 Keyboard keymap was changed. More...
 
struct  ClipboardUpdatedEvent
 Clipboard was updated. More...
 
struct  DropFileEvent
 File was dropped. More...
 
struct  DropTextEvent
 Text was dropped. More...
 
struct  DropStartedEvent
 Drop was started. More...
 
struct  DropCompletedEvent
 Drop was completed. More...
 
struct  Event
 Data structure containing information about an event. More...
 
class  EventPump
 Persistent system for polling Event data and other user input from the host environment on demand. More...
 
struct  InputManagerOptions
 Configuration options for an InputManager. More...
 
class  InputManager
 Persistent system for mapping physical Input controls to abstract output numbers and processing input events that control their associated values. More...
 
class  MessageBox
 Utility class for simple message boxes to be delivered to the user through the host environment. More...
 

Enumerations

enum class  Input : std::uint8_t {
}
 Unique identifier for a specific control on a physical input device, such as a certain keyboard key, mouse button or joystick axis. More...
 

Functions

constexpr std::size_t getInputIndex (Input input) noexcept
 Get the 0-based index of an Input. More...
 
constexpr std::string_view getInputIdentifier (Input input) noexcept
 Get the identifier string of an Input. More...
 
constexpr std::string_view getInputString (Input input) noexcept
 Get a short human-readable string description of an Input. More...
 
constexpr Input findInput (std::string_view identifier) noexcept
 Find the Input corresponding to a given identifier. More...
 

Variables

constexpr std::size_t INPUT_COUNT
 Total number of inputs that exist in the Input enumeration. More...
 

Enumeration Type Documentation

◆ Input

enum donut::events::Input : std::uint8_t
strong

Unique identifier for a specific control on a physical input device, such as a certain keyboard key, mouse button or joystick axis.

Enumerator
UNKNOWN 

Unknown input.

KEY_A 

Keyboard A key.

KEY_B 

Keyboard B key.

KEY_C 

Keyboard C key.

KEY_D 

Keyboard D key.

KEY_E 

Keyboard E key.

KEY_F 

Keyboard F key.

KEY_G 

Keyboard G key.

KEY_H 

Keyboard H key.

KEY_I 

Keyboard I key.

KEY_J 

Keyboard J key.

KEY_K 

Keyboard K key.

KEY_L 

Keyboard L key.

KEY_M 

Keyboard M key.

KEY_N 

Keyboard N key.

KEY_O 

Keyboard O key.

KEY_P 

Keyboard P key.

KEY_Q 

Keyboard Q key.

KEY_R 

Keyboard R key.

KEY_S 

Keyboard S key.

KEY_T 

Keyboard T key.

KEY_U 

Keyboard U key.

KEY_V 

Keyboard V key.

KEY_W 

Keyboard W key.

KEY_X 

Keyboard X key.

KEY_Y 

Keyboard Y key.

KEY_Z 

Keyboard Z key.

KEY_1 

Keyboard 1 key.

KEY_2 

Keyboard 2 key.

KEY_3 

Keyboard 3 key.

KEY_4 

Keyboard 4 key.

KEY_5 

Keyboard 5 key.

KEY_6 

Keyboard 6 key.

KEY_7 

Keyboard 7 key.

KEY_8 

Keyboard 8 key.

KEY_9 

Keyboard 9 key.

KEY_0 

Keyboard 0 key.

KEY_ESCAPE 

Keyboard escape key.

KEY_LCTRL 

Keyboard left control key.

KEY_RCTRL 

Keyboard right control key.

KEY_LSHIFT 

Keyboard left shift key.

KEY_RSHIFT 

Keyboard right shift key.

KEY_LALT 

Keyboard left alt key.

KEY_RALT 

Keyboard right alt key.

KEY_MENU 

Keyboard menu key.

KEY_LEFT_BRACKET 

Keyboard [ key.

KEY_RIGHT_BRACKET 

Keyboard ] key.

KEY_SEMICOLON 

Keyboard ; key.

KEY_COMMA 

Keyboard , key.

KEY_PERIOD 

Keyboard . key.

KEY_APOSTROPHE 

Keyboard ' key.

KEY_SLASH 

Keyboard / key.

KEY_BACKSLASH 

Keyboard \ key.

KEY_GRAVE 

Keyboard ` key.

KEY_EQUALS 

Keyboard = key.

KEY_MINUS 

Keyboard - key.

KEY_SPACE 

Keyboard space key.

KEY_RETURN 

Keyboard return key.

KEY_BACKSPACE 

Keyboard backspace key.

KEY_TAB 

Keyboard tab key.

KEY_PAGE_UP 

Keyboard page up key.

KEY_PAGE_DOWN 

Keyboard page down key.

KEY_END 

Keyboard end key.

KEY_HOME 

Keyboard home key.

KEY_INSERT 

Keyboard insert key.

KEY_DELETE 

Keyboard delete key.

KEY_ARROW_UP 

Keyboard up arrow key.

KEY_ARROW_DOWN 

Keyboard down arrow key.

KEY_ARROW_LEFT 

Keyboard left arrow key.

KEY_ARROW_RIGHT 

Keyboard right arrow key.

KEY_NUMPAD_PLUS 

Keyboard numpad + key.

KEY_NUMPAD_MINUS 

Keyboard numpad - key.

KEY_NUMPAD_MULTIPLY 

Keyboard numpad * key.

KEY_NUMPAD_DIVIDE 

Keyboard numpad / key.

KEY_NUMPAD_1 

Keyboard numpad 1 key.

KEY_NUMPAD_2 

Keyboard numpad 2 key.

KEY_NUMPAD_3 

Keyboard numpad 3 key.

KEY_NUMPAD_4 

Keyboard numpad 4 key.

KEY_NUMPAD_5 

Keyboard numpad 5 key.

KEY_NUMPAD_6 

Keyboard numpad 6 key.

KEY_NUMPAD_7 

Keyboard numpad 7 key.

KEY_NUMPAD_8 

Keyboard numpad 8 key.

KEY_NUMPAD_9 

Keyboard numpad 9 key.

KEY_NUMPAD_0 

Keyboard numpad 0 key.

KEY_F1 

Keyboard F1 key.

KEY_F2 

Keyboard F2 key.

KEY_F3 

Keyboard F3 key.

KEY_F4 

Keyboard F4 key.

KEY_F5 

Keyboard F5 key.

KEY_F6 

Keyboard F6 key.

KEY_F7 

Keyboard F7 key.

KEY_F8 

Keyboard F8 key.

KEY_F9 

Keyboard F9 key.

KEY_F10 

Keyboard F10 key.

KEY_F11 

Keyboard F11 key.

KEY_F12 

Keyboard F12 key.

KEY_F13 

Keyboard F13 key.

KEY_F14 

Keyboard F14 key.

KEY_F15 

Keyboard F15 key.

KEY_PRINT_SCREEN 

Keyboard PrtSc key.

KEY_SCROLL_LOCK 

Keyboard Scroll Lock key.

KEY_PAUSE 

Keyboard Pause key.

MOUSE_BUTTON_LEFT 

Mouse left click.

MOUSE_BUTTON_RIGHT 

Mouse right click.

MOUSE_BUTTON_MIDDLE 

Mouse middle button.

MOUSE_BUTTON_BACK 

Mouse back button.

MOUSE_BUTTON_FORWARD 

Mouse forward button.

MOUSE_SCROLL_UP 

Mouse scroll wheel upward movement.

MOUSE_SCROLL_DOWN 

Mouse scroll wheel downward movement.

MOUSE_SCROLL_LEFT 

Mouse scroll wheel leftward movement.

MOUSE_SCROLL_RIGHT 

Mouse scroll wheel rightward movement.

MOUSE_MOTION_UP 

Mouse up movement.

MOUSE_MOTION_DOWN 

Mouse down movement.

MOUSE_MOTION_LEFT 

Mouse left movement.

MOUSE_MOTION_RIGHT 

Mouse right movement.

CONTROLLER_BUTTON_A 

Controller A button.

CONTROLLER_BUTTON_B 

Controller B button.

CONTROLLER_BUTTON_X 

Controller X button.

CONTROLLER_BUTTON_Y 

Controller Y button.

CONTROLLER_BUTTON_BACK 

Controller back button.

CONTROLLER_BUTTON_GUIDE 

Controller guide button.

CONTROLLER_BUTTON_START 

Controller start button.

CONTROLLER_BUTTON_LEFT_STICK 

Controller left analog stick button.

CONTROLLER_BUTTON_RIGHT_STICK 

Controller right analog stick button.

CONTROLLER_BUTTON_LEFT_SHOULDER 

Controller left shoulder button.

CONTROLLER_BUTTON_RIGHT_SHOULDER 

Controller right shoulder button.

CONTROLLER_BUTTON_DPAD_UP 

Controller D-pad up.

CONTROLLER_BUTTON_DPAD_DOWN 

Controller D-pad down.

CONTROLLER_BUTTON_DPAD_LEFT 

Controller D-pad left.

CONTROLLER_BUTTON_DPAD_RIGHT 

Controller D-pad right.

CONTROLLER_BUTTON_MISC1 

Controller misc1 button.

CONTROLLER_BUTTON_PADDLE1 

Controller paddle 1.

CONTROLLER_BUTTON_PADDLE2 

Controller paddle 2.

CONTROLLER_BUTTON_PADDLE3 

Controller paddle 3.

CONTROLLER_BUTTON_PADDLE4 

Controller paddle 4.

CONTROLLER_BUTTON_TOUCHPAD 

Controller touchpad button.

CONTROLLER_AXIS_LEFT_STICK_UP 

Controller left analog stick upward movement.

CONTROLLER_AXIS_LEFT_STICK_DOWN 

Controller left analog stick downward movement.

CONTROLLER_AXIS_LEFT_STICK_LEFT 

Controller left analog stick leftward movement.

CONTROLLER_AXIS_LEFT_STICK_RIGHT 

Controller left analog stick rightward movement.

CONTROLLER_AXIS_RIGHT_STICK_UP 

Controller right analog stick upward movement.

CONTROLLER_AXIS_RIGHT_STICK_DOWN 

Controller right analog stick downward movement.

CONTROLLER_AXIS_RIGHT_STICK_LEFT 

Controller right analog stick leftward movement.

CONTROLLER_AXIS_RIGHT_STICK_RIGHT 

Controller right analog stick rightward movement.

CONTROLLER_AXIS_LEFT_TRIGGER 

Controller left trigger movement.

CONTROLLER_AXIS_RIGHT_TRIGGER 

Controller right trigger movement.

TOUCH_FINGER_TAP 

Finger tap.

TOUCH_FINGER_PRESSURE 

Finger pressure.

TOUCH_FINGER_MOTION_UP 

Finger up movement.

TOUCH_FINGER_MOTION_DOWN 

Finger down movement.

TOUCH_FINGER_MOTION_LEFT 

Finger left movement.

TOUCH_FINGER_MOTION_RIGHT 

Finger right movement.

Function Documentation

◆ getInputIndex()

constexpr std::size_t donut::events::getInputIndex ( Input  input)
constexprnoexcept

Get the 0-based index of an Input.

Parameters
inputvalid input value to get the index of.
Returns
an integer between 0 (inclusive) and INPUT_COUNT (exclusive) that uniquely identifies the given input.

◆ getInputIdentifier()

constexpr std::string_view donut::events::getInputIdentifier ( Input  input)
constexprnoexcept

Get the identifier string of an Input.

Parameters
inputvalid input value to get the identifier of.
Returns
a reference to a statically allocated ASCII string that uniquely identifies the given input, starts with a lowercase letter and only contains lowercase letters, decimal digits and underscores.
See also
findInput()

◆ getInputString()

constexpr std::string_view donut::events::getInputString ( Input  input)
constexprnoexcept

Get a short human-readable string description of an Input.

Parameters
inputvalid input value to get the string of.
Returns
a reference to a statically allocated ASCII string that describes the given input in English.

◆ findInput()

constexpr Input donut::events::findInput ( std::string_view  identifier)
constexprnoexcept

Find the Input corresponding to a given identifier.

Parameters
identifierthe identifier string to search for.
Returns
if found, returns the input value whose identifier matches the given string. Otherwise, returns Input::UNKNOWN.
See also
getInputIdentifier()
Examples
example_game.cpp.

Variable Documentation

◆ INPUT_COUNT

constexpr std::size_t donut::events::INPUT_COUNT
inlineconstexpr

Total number of inputs that exist in the Input enumeration.