Drag[en]gine Game Engine  1.0
deInputEvent Class Reference

Input event. More...

#include <deInputEvent.h>

Public Types

enum  eEvents {
  eeKeyPress, eeKeyRelease, eeKeyType, eeMousePress,
  eeMouseRelease, eeMouseMove, eeAxisMove, eeButtonPress,
  eeButtonRelease, eeDeviceAttached, eeDeviceDetached, eeDeviceParamsChanged
}
 Event Codes. More...
 
enum  eStateModifiers { esmNone = 0, esmShift = 0x1, esmControl = 0x2, esmAlt = 0x4 }
 State modifiers. More...
 

Public Member Functions

Constructors and Destructors
 deInputEvent ()
 Create input event. More...
 
 deInputEvent (const deInputEvent &event)
 Create copy of input event. More...
 
 ~deInputEvent ()
 Clean up the event object. More...
 
Management
eEvents GetType () const
 Event type. More...
 
void SetType (eEvents type)
 Set event type. More...
 
int GetDevice () const
 Event device. More...
 
void SetDevice (int device)
 Set event device. More...
 
int GetCode () const
 Event code. More...
 
void SetCode (int code)
 Set event code. More...
 
int GetState () const
 Event state. More...
 
void SetState (int state)
 Set event state. More...
 
int GetKeyChar () const
 Key character if a keyboard event. More...
 
void SetKeyChar (int keyChar)
 Set key character if a keyboard event. More...
 
int GetX () const
 X position if a mouse event. More...
 
void SetX (int x)
 Set X position if a mouse event. More...
 
int GetY () const
 Y position if a mouse event. More...
 
void SetY (int y)
 Set Y position if a mouse event. More...
 
const timeval & GetTime () const
 Time the event occured. More...
 
void SetTime (const timeval &eventTime)
 Set time the event occured. More...
 
void SetFrom (const deInputEvent &event)
 Copies properties of another event to this event. More...
 
Operators
bool operator== (const deInputEvent &event) const
 Two events are equal. More...
 
deInputEventoperator= (const deInputEvent &event)
 Copy input event. More...
 

Detailed Description

Input event.

Event objects are generated by the input module and placed in the game engine event queue. The script module then reads those events and processes them.

Member Enumeration Documentation

◆ eEvents

Event Codes.

Enumerator
eeKeyPress 

A key on the keyboard has been pressed.

eeKeyRelease 

A key on the keyboard has been released.

eeKeyType 

A key on the keyboard has been pressed and released.

This is used for key repetion in which case only the key type event is send multiple times but the key press and key release only once.

Deprecated:
Key repetition is not allowed by the input module anymore. Repetition is provided on the game script level as otherwise it is very tricky to work with those input events generated.
eeMousePress 

A mouse button has been pressed.

eeMouseRelease 

A mouse button has been released.

eeMouseMove 

The mouse has been moved to a new location.

eeAxisMove 

Device axis moved.

eeButtonPress 

Device button pressed.

eeButtonRelease 

Device button released.

eeDeviceAttached 

Input device has been attached to host system.

eeDeviceDetached 

Input device has been detatched from host system.

eeDeviceParamsChanged 

Input device parameters changed.

◆ eStateModifiers

State modifiers.

Enumerator
esmNone 

No modifier.

esmShift 

Shift modifier.

esmControl 

Control modifier.

esmAlt 

Alt modifier.

Constructor & Destructor Documentation

◆ deInputEvent() [1/2]

deInputEvent::deInputEvent ( )

Create input event.

◆ deInputEvent() [2/2]

deInputEvent::deInputEvent ( const deInputEvent event)

Create copy of input event.

◆ ~deInputEvent()

deInputEvent::~deInputEvent ( )

Clean up the event object.

Member Function Documentation

◆ GetCode()

int deInputEvent::GetCode ( ) const
inline

Event code.

This is either a key code or a mouse or gamepay axis or button.

References SetCode().

◆ GetDevice()

int deInputEvent::GetDevice ( ) const
inline

Event device.

References SetDevice().

◆ GetKeyChar()

int deInputEvent::GetKeyChar ( ) const
inline

Key character if a keyboard event.

References SetKeyChar().

◆ GetState()

int deInputEvent::GetState ( ) const
inline

Event state.

ORed combination of members of deInputEvent::eStateModifiers.

References SetState().

◆ GetTime()

const timeval& deInputEvent::GetTime ( ) const
inline

Time the event occured.

References operator=(), operator==(), SetFrom(), and SetTime().

◆ GetType()

eEvents deInputEvent::GetType ( ) const
inline

Event type.

References SetType().

◆ GetX()

int deInputEvent::GetX ( ) const
inline

X position if a mouse event.

References SetX().

◆ GetY()

int deInputEvent::GetY ( ) const
inline

Y position if a mouse event.

References SetY().

◆ operator=()

deInputEvent& deInputEvent::operator= ( const deInputEvent event)

Copy input event.

Referenced by GetTime().

◆ operator==()

bool deInputEvent::operator== ( const deInputEvent event) const

Two events are equal.

Referenced by GetTime().

◆ SetCode()

void deInputEvent::SetCode ( int  code)

Set event code.

This is either a key code or a mouse or gamepay axis or button.

Referenced by GetCode().

◆ SetDevice()

void deInputEvent::SetDevice ( int  device)

Set event device.

Exceptions
deeInvalidParamdevice is less than 0.

Referenced by GetDevice().

◆ SetFrom()

void deInputEvent::SetFrom ( const deInputEvent event)

Copies properties of another event to this event.

Referenced by GetTime().

◆ SetKeyChar()

void deInputEvent::SetKeyChar ( int  keyChar)

Set key character if a keyboard event.

Referenced by GetKeyChar().

◆ SetState()

void deInputEvent::SetState ( int  state)

Set event state.

Parameters
[in]codeORed combination of members of deInputEvent::eStateModifiers.

Referenced by GetState().

◆ SetTime()

void deInputEvent::SetTime ( const timeval &  eventTime)

Set time the event occured.

Referenced by GetTime().

◆ SetType()

void deInputEvent::SetType ( eEvents  type)

Set event type.

Exceptions
deeInvalidParamtype is not a member of deInputEvent::eEvents.

Referenced by GetType().

◆ SetX()

void deInputEvent::SetX ( int  x)

Set X position if a mouse event.

Referenced by GetX().

◆ SetY()

void deInputEvent::SetY ( int  y)

Set Y position if a mouse event.

Referenced by GetY().


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