Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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::PositionTarget Ogre::PositionTarget Ogre::EventTarget List of all members.

Public Methods

 EventProcessor ()
virtual ~EventProcessor ()
void startProcessingEvents ()
 Removes this from being a FrameListener, and deactivates the queue. More...

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

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

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

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

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

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

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

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

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

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

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

void processMouseEvent (MouseEvent *e)
void addMouseListener (MouseListener *l)
void removeMouseListener (MouseListener *l)
void processMouseMotionEvent (MouseEvent *e)
void addMouseMotionListener (MouseMotionListener *l)
void removeMouseMotionListener (MouseMotionListener *l)

Static Public Methods

EventProcessor & getSingleton (void)
 Override standard Singleton retrieval. More...

EventProcessor * getSingletonPtr (void)

Protected Types

typedef std::vector< EventDispatcher * > DispatcherList

Protected Methods

void cleanup ()
 empty queue and cleanup objects. More...


Protected Attributes

EventQueuemEventQueue
InputReadermInputDevice
DispatcherList mDispatcherList
MouseListenermMouseListener
MouseMotionListenermMouseMotionListener

Static Protected Attributes

EventProcessor * ms_Singleton = 0

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);


Member Typedef Documentation

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


Constructor & Destructor Documentation

Ogre::EventProcessor::EventProcessor  
 

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::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 [inline, 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.

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.

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   [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::Singleton< EventProcessor >::getSingletonPtr void    [inline, static, inherited]
 

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.

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::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::MouseTarget::removeMouseListener MouseListener   l [inherited]
 

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

void Ogre::EventProcessor::startProcessingEvents  
 

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

void Ogre::EventProcessor::stopProcessingEvents  
 

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


Member Data Documentation

DispatcherList Ogre::EventProcessor::mDispatcherList [protected]
 

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

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

MouseListener* Ogre::MouseTarget::mMouseListener [protected, inherited]
 

MouseMotionListener* Ogre::MouseMotionTarget::mMouseMotionListener [protected, inherited]
 

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

Copyright © 2002 by The OGRE Team