Loading...
Searching...
No Matches
Event Struct Reference

Event sent by system, interface or game. More...

`#include <src/common/event.h>`

## Public Member Functions

| Event (EventType type=EVENT_NULL)
| Event (const Event &)=delete
Event & | operator= (const Event &)=delete
| Event (Event &&other)
Event & | operator= (Event &&other)
template<typename EventDataSubclass>
EventDataSubclass * | GetData ()
| Convenience function for getting appropriate EventData subclass.
template<typename EventDataSubclass>
const EventDataSubclass * | GetData () const
| Convenience function for getting appropriate EventData subclass.
Event | Clone () const
| Returns a clone of this event.

## Public Attributes

EventType | type
| Type of event.
float | rTime
Math::Vector | motionInput
Math::Vector | cameraInput
unsigned int | kmodState
Math::Point | mousePos
unsigned int | mouseButtonsState
long | customParam
std::unique_ptr< EventData > | data
| Additional data for some events.

## Detailed Description

Event sent by system, interface or game.

Event is described by its type (EventType) and anonymous union that contains additional data about the event. Different members of the union are filled with different event types. With some events, nothing is filled (it's zeroed out). The union contains roughly the same information as SDL_Event struct but packaged to independent structs and fields.

## Member Function Documentation

## GetData() [1/2]

template<typename EventDataSubclass>

EventDataSubclass * Event::GetData | ( |  | ) |

inline

Convenience function for getting appropriate EventData subclass.

## GetData() [2/2]

template<typename EventDataSubclass>

const EventDataSubclass * Event::GetData | ( |  | ) | const

inline

Convenience function for getting appropriate EventData subclass.

## Clone()

Event Event::Clone | ( |  | ) | const

inline

Returns a clone of this event.

## Member Data Documentation

## type

EventType Event::type

Type of event.

## rTime

float Event::rTime

Relative time since last EVENT_FRAME Scope: only EVENT_FRAME events

## motionInput

Math::Vector Event::motionInput

Motion vector set by keyboard or joystick (managed by CInput) Scope: all system events

## cameraInput

Math::Vector Event::cameraInput

Motion vector set by numeric keyboard (managed by CInput) Scope: all system events

## kmodState

unsigned int Event::kmodState

Current state of keyboard modifier keys: bitmask made of KEY_MOD(...) macro values (from common/key.h) Scope: all system events

## mousePos

Math::Point Event::mousePos

Current position of mouse cursor in interface coords Scope: all system events

## mouseButtonsState

unsigned int Event::mouseButtonsState

Current state of mouse buttons: bitmask of MouseButton enum values Scope: all system events

## customParam

long Event::customParam

Custom parameter that may be set for some events Scope: some interface events

## data

std::unique_ptr<EventData> Event::data

Additional data for some events.

The documentation for this struct was generated from the following file:

- src/common/event.h