Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Ogre::EventProcessor Class Reference

The EventProcessor controls getting events, storing them in a queue, and dispatching events. More...

#include <OgreEventProcessor.h>

Inheritance diagram for Ogre::EventProcessor:

Ogre::FrameListener Ogre::MouseTarget Ogre::MouseMotionTarget Ogre::Singleton< EventProcessor > Ogre::KeyTarget Ogre::PositionTarget Ogre::PositionTarget Ogre::EventTarget Ogre::EventTarget Ogre::EventTarget List of all members.

Public Member Functions

 EventProcessor ()
virtual ~EventProcessor ()
void startProcessingEvents (bool registerListener=true)
 Registers FrameListener, and activates the queue.

void stopProcessingEvents ()
 Removes this from being a FrameListener, and deactivates the queue.

void initialise (RenderWindow *ren)
 Creates the Queue object, Creates the InputReader object initialises the InputReader to use buffered input.

void processEvent (InputEvent *e)
 Processes default events, these are events are aren't handled by any dispatcher.

void addCursorMoveListener (MouseMotionListener *c)
 Adds a mouse motion listener to the cursor object.

void removeCursorMoveListener (MouseMotionListener *c)
 Removes a mouse motion listener to the cursor object.

void addTargetManager (TargetManager *targetManager)
 Creates a dispatcher object that dispatches to the targetManager.

void addEventTarget (EventTarget *eventTarget)
 Creates a dispatcher object that dispatches to the targetManager.

bool frameStarted (const FrameEvent &evt)
 Processes all events on the queue.

Real getTop () const
 returns 0, since this is a default event target, default events have a top of 0

Real getLeft () const
 returns 0, since this is a default event target, default events have a left of 0

PositionTargetgetPositionTargetParent () const
 returns NULL, There is no parent of the default event target.

bool isKeyEnabled () const
InputReadergetInputReader ()
virtual bool frameEnded (const FrameEvent &evt)
 Called just after a frame has been rendered.

void processMouseEvent (MouseEvent *e)
void addMouseListener (MouseListener *l)
void removeMouseListener (MouseListener *l)
bool isMouseWithin () const
void processMouseMotionEvent (MouseEvent *e)
void addMouseMotionListener (MouseMotionListener *l)
void removeMouseMotionListener (MouseMotionListener *l)
void processKeyEvent (KeyEvent *e)
void addKeyListener (KeyListener *l)
void removeKeyListener (KeyListener *l)

Static Public Member Functions

EventProcessorgetSingleton (void)
 Override standard Singleton retrieval.

EventProcessorgetSingletonPtr (void)
 Override standard Singleton retrieval.


Protected Types

typedef std::list< EventDispatcher * > DispatcherList
typedef std::list< EventTarget * > EventTargetList

Protected Member Functions

void cleanup ()
 empty queue and cleanup objects


Protected Attributes

EventQueuemEventQueue
InputReadermInputDevice
DispatcherList mDispatcherList
EventTargetList mEventTargetList
bool mRegisteredAsFrameListener
std::set< MouseListener * > mMouseListeners
bool mMouseWithin
std::set< MouseMotionListener * > mMouseMotionListeners
std::set< KeyListener * > mKeyListeners

Static Protected Attributes

EventProcessorms_Singleton

Detailed Description

The EventProcessor controls getting events, storing them in a queue, and dispatching events.

Remarks:
An application can create an instance of this class to receive buffered input, as opposed to creating an InputReader directly and retrieving snapshot state only. This class contains an InputReader which it uses to create InputEvents which are then stored FIFO in the EventQueue.
The EventProcessor is a frame listener, so each frame, it empties the entire queue to the list of dispatchers. Each dispatcher corresponds to a registered TargetManager. The TargetManagers need to be registered with the Processor before initialise is called. After intialise is called, the Processor will start processing events once startProcessingEvents is called.
The Processor acts like a default EventTarget, so it can process events that no dispatcher consumes. You can listen default actions to the processor by e.g. mProcessor->addMouseListener(defaultMouseMovement);

Definition at line 90 of file OgreEventProcessor.h.


Member Typedef Documentation

typedef std::list<EventDispatcher*> Ogre::EventProcessor::DispatcherList [protected]
 

Definition at line 100 of file OgreEventProcessor.h.

typedef std::list<EventTarget*> Ogre::EventProcessor::EventTargetList [protected]
 

Definition at line 101 of file OgreEventProcessor.h.


Constructor & Destructor Documentation

Ogre::EventProcessor::EventProcessor  ) 
 

virtual Ogre::EventProcessor::~EventProcessor  )  [virtual]
 


Member Function Documentation

void Ogre::EventProcessor::addCursorMoveListener MouseMotionListener c  ) 
 

Adds a mouse motion listener to the cursor object.

This keeps the Cursor object hidden.

void Ogre::EventProcessor::addEventTarget EventTarget eventTarget  ) 
 

Creates a dispatcher object that dispatches to the targetManager.

Adds the new dispatcher object to the dispatcher list.

void Ogre::KeyTarget::addKeyListener KeyListener l  )  [inherited]
 

void Ogre::MouseTarget::addMouseListener MouseListener l  )  [inherited]
 

void Ogre::MouseMotionTarget::addMouseMotionListener MouseMotionListener l  )  [inherited]
 

void Ogre::EventProcessor::addTargetManager TargetManager targetManager  ) 
 

Creates a dispatcher object that dispatches to the targetManager.

Adds the new dispatcher object to the dispatcher list.

void Ogre::EventProcessor::cleanup  )  [protected]
 

empty queue and cleanup objects

virtual bool Ogre::FrameListener::frameEnded const FrameEvent evt  )  [virtual, inherited]
 

Called just after a frame has been rendered.

Returns:
True to continue with the next frame, false to drop out of the rendering loop.

Reimplemented in Ogre::ParticleSystemManager, and Ogre::FrameTimeControllerValue.

Definition at line 95 of file OgreFrameListener.h.

bool Ogre::EventProcessor::frameStarted const FrameEvent evt  )  [virtual]
 

Processes all events on the queue.

sends each event to each dispatcher. deletes the event objects

Reimplemented from Ogre::FrameListener.

InputReader* Ogre::EventProcessor::getInputReader  ) 
 

Definition at line 188 of file OgreEventProcessor.h.

Real Ogre::EventProcessor::getLeft  )  const [virtual]
 

returns 0, since this is a default event target, default events have a left of 0

Implements Ogre::PositionTarget.

PositionTarget* Ogre::EventProcessor::getPositionTargetParent  )  const [virtual]
 

returns NULL, There is no parent of the default event target.

Implements Ogre::PositionTarget.

EventProcessor& Ogre::EventProcessor::getSingleton void   )  [static]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< EventProcessor >.

EventProcessor* Ogre::EventProcessor::getSingletonPtr void   )  [static]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< EventProcessor >.

Real Ogre::EventProcessor::getTop  )  const [virtual]
 

returns 0, since this is a default event target, default events have a top of 0

Implements Ogre::PositionTarget.

void Ogre::EventProcessor::initialise RenderWindow ren  ) 
 

Creates the Queue object, Creates the InputReader object initialises the InputReader to use buffered input.

bool Ogre::EventProcessor::isKeyEnabled  )  const [virtual]
 

Implements Ogre::PositionTarget.

Definition at line 185 of file OgreEventProcessor.h.

bool Ogre::MouseTarget::isMouseWithin  )  const [inherited]
 

void Ogre::EventProcessor::processEvent InputEvent e  )  [virtual]
 

Processes default events, these are events are aren't handled by any dispatcher.

Implements Ogre::EventTarget.

void Ogre::KeyTarget::processKeyEvent KeyEvent e  )  [inherited]
 

void Ogre::MouseTarget::processMouseEvent MouseEvent e  )  [inherited]
 

void Ogre::MouseMotionTarget::processMouseMotionEvent MouseEvent e  )  [inherited]
 

void Ogre::EventProcessor::removeCursorMoveListener MouseMotionListener c  ) 
 

Removes a mouse motion listener to the cursor object.

This keeps the Cursor object hidden.

void Ogre::KeyTarget::removeKeyListener KeyListener l  )  [inherited]
 

void Ogre::MouseTarget::removeMouseListener MouseListener l  )  [inherited]
 

void Ogre::MouseMotionTarget::removeMouseMotionListener MouseMotionListener l  )  [inherited]
 

void Ogre::EventProcessor::startProcessingEvents bool  registerListener = true  ) 
 

Registers FrameListener, and activates the queue.

void Ogre::EventProcessor::stopProcessingEvents  ) 
 

Removes this from being a FrameListener, and deactivates the queue.


Member Data Documentation

DispatcherList Ogre::EventProcessor::mDispatcherList [protected]
 

Definition at line 102 of file OgreEventProcessor.h.

EventQueue* Ogre::EventProcessor::mEventQueue [protected]
 

Definition at line 93 of file OgreEventProcessor.h.

EventTargetList Ogre::EventProcessor::mEventTargetList [protected]
 

Definition at line 103 of file OgreEventProcessor.h.

InputReader* Ogre::EventProcessor::mInputDevice [protected]
 

Definition at line 99 of file OgreEventProcessor.h.

std::set<KeyListener*> Ogre::KeyTarget::mKeyListeners [protected, inherited]
 

Definition at line 52 of file OgreKeyTarget.h.

std::set<MouseListener*> Ogre::MouseTarget::mMouseListeners [protected, inherited]
 

Definition at line 58 of file OgreMouseTarget.h.

std::set<MouseMotionListener*> Ogre::MouseMotionTarget::mMouseMotionListeners [protected, inherited]
 

Definition at line 58 of file OgreMouseMotionTarget.h.

bool Ogre::MouseTarget::mMouseWithin [protected, inherited]
 

Definition at line 61 of file OgreMouseTarget.h.

bool Ogre::EventProcessor::mRegisteredAsFrameListener [protected]
 

Definition at line 104 of file OgreEventProcessor.h.

EventProcessor * Ogre::Singleton< EventProcessor >::ms_Singleton [static, protected, inherited]
 

Definition at line 54 of file OgreSingleton.h.


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

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 13:00:26 2006