Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members  

PLMInput Class Reference

Event manager. More...

#include <PLMInput.hpp>

Inheritance diagram for PLMInput:

Inheritance graph
[legend]
List of all members.

Public Types

enum  

Public Methods

void AddEventType (u32 mask)
void RemoveEventType (u32 mask)
void SetEventTypes (u32 mask)
u32 GetEventTypes () const
bool GetNextEvent (PLMEvent *ev)
bool WaitNextEvent (PLMEvent *ev)
bool WaitNextEvent (u8 type, PLMEvent *ev)
void Flush ()
u8 GetMouseState (s32 *x, s32 *y)
PLMKeyMod GetModifierState ()
char * GetKeyName (PLMKeyCode key)
u32 NbInstances ()
u32 SDLState ()

Static Public Methods

PLMInput * Singleton ()

Detailed Description

Event manager.

Description:

  • this object is a singleton (only one instance), get it with Singleton()
  • its main task is to get all system events and add them to an internal list, if their type is included in the current settings
  • let the user define which type of events to keep
  • get events from the list (and remove them)
Example:
   PLMInput *in = PLMInput::Singleton ();  // get the global instance
   in->SetEventTypes (PLMInput::EM_STD);  // set default event mask
   in->SetKeyRepeat ();                   // enable key repeat
   PLMEvent ev;

   while (in->GetNextEvent (&ev))
     {
       switch (ev.type)
         {
         case PLMEV_* : ...
         }
       // add some delay to avoid raising CPU load to 100% (see PLMTimer example)
     }


Member Enumeration Documentation

anonymous enum
 

Init keyboard repeat mode (or disable it).

If enabled, key-down events are generated as long as a key is down. If disabled, only one key-down event is generated. The key-up event is always generated when the key is released (in both modes).

Parameters:
delay  number of milliseconds after a key press to start repeat mode, 0 disables repeat mode.
interval  number of milliseconds between generated events, once the repeat mode is started (the key is pressed).


Member Function Documentation

PLMInput* PLMInput::Singleton   [static]
 

Get an instance of the event manager.

void PLMInput::AddEventType u32    mask
 

Add a set of types of events to be reported in the queue.

The given selection in mask is added to current mask. Use a combination of EventMasks enums.

void PLMInput::RemoveEventType u32    mask
 

Remove a set of types of events from the current selection.

Use a combination of EventMasks enums.

void PLMInput::SetEventTypes u32    mask
 

Specify which types of events should be reported.

This method replaces the current selection by mask. Use a combination of EventMasks enums.

u32 PLMInput::GetEventTypes   [inline]
 

Get the current selection of event types.

bool PLMInput::GetNextEvent PLMEvent   ev [inline]
 

Get the next event in the queue.

If ev is not NULL, the next event in the queue is copied into ev and removed from the queue.

Returns:
true on success and false if the queue is empty.

bool PLMInput::WaitNextEvent PLMEvent   ev [inline]
 

Same as GetNextEvent(), but if the queue is empty wait until one event is added.

Returns:
true on success, false on error.

bool PLMInput::WaitNextEvent u8    type,
PLMEvent   ev
 

Same as WaitNextEvent(), but wait for a specific type of event.

All other events of a different type are lost. Note: type must be a single type of event, not a combination.

void PLMInput::Flush  
 

Remove all pending events (clear the queue).

u8 PLMInput::GetMouseState s32 *    x,
s32 *    y
 

Get immediate mouse state.

Returns:
button state (bit mask), and copy current position in x, y.

PLMKeyMod PLMInput::GetModifierState   [inline]
 

Get immediate keyboard modifier state (shift, ctrl, ...).

Returns:
a mask of PLMKMOD_* (see PLMKeyMod enum in PLMKey.hpp)

char * PLMInput::GetKeyName PLMKeyCode    key [inline]
 

Get a human readable name for a key (like "left shift").

u32 PLMSDLMgr::NbInstances   [inline, inherited]
 

Get the current number of instances (classes using SDL).

u32 PLMSDLMgr::SDLState   [inline, inherited]
 

Get the current value of SDL flags (initialized sub-systems).


The documentation for this class was generated from the following file:
  • PLMInput.hpp

Generated by Doxygen 1.2.18 on Tue Oct 26 12:07:38 2004.