Colobot
Public Member Functions | Public Attributes | List of all members
Event Struct Reference

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

#include <event.h>

Public Member Functions

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

Public Attributes

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

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

template<typename EventDataSubclass >
EventDataSubclass* Event::GetData ( )
inline

Convenience function for getting appropriate EventData subclass.

template<typename EventDataSubclass >
const EventDataSubclass* Event::GetData ( ) const
inline

Convenience function for getting appropriate EventData subclass.

Event Event::Clone ( ) const
inline

Returns a clone of this event.

Member Data Documentation

EventType Event::type

Type of event.

float Event::rTime

Relative time since last EVENT_FRAME Scope: only EVENT_FRAME events

Math::Vector Event::motionInput

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

Math::Vector Event::cameraInput

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

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

Math::Point Event::mousePos

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

unsigned int Event::mouseButtonsState

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

long Event::customParam

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

std::unique_ptr<EventData> Event::data

Additional data for some events.


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