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:

Inheritance graph
[legend]
List of all members.

Public Methods

 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 Methods

EventProcessor & getSingleton (void)
 Override standard Singleton retrieval.

EventProcessor * getSingletonPtr (void)
 Override standard Singleton retrieval.


Protected Types

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

Protected Methods

void cleanup ()
 empty queue and cleanup objects


Protected Attributes

EventQueuemEventQueue
InputReadermInputDevice
DispatcherList mDispatcherList
EventTargetList mEventTargetList
bool mRegisteredAsFrameListener
MouseListenermMouseListener
bool mMouseWithin
MouseMotionListenermMouseMotionListener
KeyListenermKeyListener

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

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  
 

Definition at line 51 of file OgreEventProcessor.cpp.

References mEventQueue, mInputDevice, and mRegisteredAsFrameListener.

Ogre::EventProcessor::~EventProcessor   [virtual]
 

Definition at line 61 of file OgreEventProcessor.cpp.

References cleanup().


Member Function Documentation

void Ogre::EventProcessor::addCursorMoveListener MouseMotionListener   c
 

Adds a mouse motion listener to the cursor object.

This keeps the Cursor object hidden.

Definition at line 203 of file OgreEventProcessor.cpp.

References Ogre::InputReader::addCursorMoveListener(), and mInputDevice.

void Ogre::EventProcessor::addEventTarget EventTarget   eventTarget
 

Creates a dispatcher object that dispatches to the targetManager.

Adds the new dispatcher object to the dispatcher list.

Definition at line 119 of file OgreEventProcessor.cpp.

References mEventTargetList.

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

Definition at line 66 of file OgreKeyTarget.cpp.

References Ogre::KeyTarget::mKeyListener.

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

Definition at line 87 of file OgreMouseTarget.cpp.

References Ogre::MouseTarget::mMouseListener.

Referenced by Ogre::ListGuiElement::addListItem(), Ogre::ScrollBarGuiElement::setScrollBitName(), and Ogre::GuiPressable::setSource().

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

Definition at line 66 of file OgreMouseMotionTarget.cpp.

References Ogre::MouseMotionTarget::mMouseMotionListener.

Referenced by Ogre::InputReader::addCursorMoveListener(), Ogre::ListGuiElement::addListItem(), Ogre::PopupMenuGuiElement::PopupMenuGuiElement(), and Ogre::ScrollBarGuiElement::setScrollBitName().

void Ogre::EventProcessor::addTargetManager TargetManager   targetManager
 

Creates a dispatcher object that dispatches to the targetManager.

Adds the new dispatcher object to the dispatcher list.

Definition at line 112 of file OgreEventProcessor.cpp.

References mDispatcherList.

void Ogre::EventProcessor::cleanup   [protected]
 

empty queue and cleanup objects

Definition at line 68 of file OgreEventProcessor.cpp.

References mDispatcherList, mEventQueue, and mInputDevice.

Referenced by initialise(), and ~EventProcessor().

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.

Definition at line 139 of file OgreEventProcessor.cpp.

References Ogre::InputReader::capture(), Ogre::EventQueue::getSize(), mEventQueue, mInputDevice, Ogre::EventQueue::pop(), and processEvent().

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.

Definition at line 214 of file OgreEventProcessor.cpp.

References Ogre::Real.

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

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

Implements Ogre::PositionTarget.

Definition at line 226 of file OgreEventProcessor.cpp.

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 >.

Definition at line 45 of file OgreEventProcessor.cpp.

References Ogre::Singleton< EventProcessor >::ms_Singleton.

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 >.

Definition at line 41 of file OgreEventProcessor.cpp.

References Ogre::Singleton< EventProcessor >::ms_Singleton.

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.

Definition at line 220 of file OgreEventProcessor.cpp.

References Ogre::Real.

void Ogre::EventProcessor::initialise RenderWindow   ren
 

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

Definition at line 98 of file OgreEventProcessor.cpp.

References cleanup(), Ogre::InputReader::initialise(), mEventQueue, mInputDevice, and Ogre::InputReader::useBufferedInput().

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

Implements Ogre::PositionTarget.

Definition at line 185 of file OgreEventProcessor.h.

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

Definition at line 106 of file OgreMouseTarget.cpp.

References Ogre::MouseTarget::mMouseWithin.

Referenced by Ogre::ButtonGuiElement::updateMaterials(), and Ogre::BorderButtonGuiElement::updateMaterials().

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

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

Implements Ogre::EventTarget.

Definition at line 154 of file OgreEventProcessor.cpp.

References Ogre::InputEvent::getID(), Ogre::InputEvent::isConsumed(), mDispatcherList, mEventTargetList, Ogre::KeyTarget::processKeyEvent(), Ogre::MouseTarget::processMouseEvent(), and Ogre::MouseMotionTarget::processMouseMotionEvent().

Referenced by frameStarted().

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

Definition at line 45 of file OgreKeyTarget.cpp.

References Ogre::InputEvent::getID(), Ogre::KeyListener::keyClicked(), Ogre::KeyListener::keyPressed(), Ogre::KeyListener::keyReleased(), and Ogre::KeyTarget::mKeyListener.

Referenced by processEvent().

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

Definition at line 47 of file OgreMouseTarget.cpp.

References Ogre::InputEvent::getID(), Ogre::MouseTarget::mMouseListener, Ogre::MouseTarget::mMouseWithin, Ogre::MouseListener::mouseClicked(), Ogre::MouseListener::mouseDragDropped(), Ogre::MouseListener::mouseDragEntered(), Ogre::MouseListener::mouseDragExited(), Ogre::MouseListener::mouseEntered(), Ogre::MouseListener::mouseExited(), Ogre::MouseListener::mousePressed(), and Ogre::MouseListener::mouseReleased().

Referenced by Ogre::GuiElement::processEvent(), processEvent(), and Ogre::Cursor::processEvent().

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

Definition at line 45 of file OgreMouseMotionTarget.cpp.

References Ogre::InputEvent::getID(), Ogre::MouseMotionTarget::mMouseMotionListener, Ogre::MouseMotionListener::mouseDragged(), Ogre::MouseMotionListener::mouseDragMoved(), and Ogre::MouseMotionListener::mouseMoved().

Referenced by Ogre::GuiElement::processEvent(), processEvent(), and Ogre::Cursor::processEvent().

void Ogre::EventProcessor::removeCursorMoveListener MouseMotionListener   c
 

Removes a mouse motion listener to the cursor object.

This keeps the Cursor object hidden.

Definition at line 208 of file OgreEventProcessor.cpp.

References mInputDevice, and Ogre::InputReader::removeCursorMoveListener().

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

Definition at line 75 of file OgreKeyTarget.cpp.

References Ogre::KeyTarget::mKeyListener.

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

Definition at line 96 of file OgreMouseTarget.cpp.

References Ogre::MouseTarget::mMouseListener.

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

Definition at line 75 of file OgreMouseMotionTarget.cpp.

References Ogre::MouseMotionTarget::mMouseMotionListener.

Referenced by Ogre::InputReader::removeCursorMoveListener().

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

Registers FrameListener, and activates the queue.

Definition at line 126 of file OgreEventProcessor.cpp.

References Ogre::EventQueue::activateEventQueue(), mEventQueue, and mRegisteredAsFrameListener.

void Ogre::EventProcessor::stopProcessingEvents  
 

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

Definition at line 84 of file OgreEventProcessor.cpp.

References Ogre::EventQueue::activateEventQueue(), mEventQueue, and mRegisteredAsFrameListener.


Member Data Documentation

DispatcherList Ogre::EventProcessor::mDispatcherList [protected]
 

Definition at line 102 of file OgreEventProcessor.h.

Referenced by addTargetManager(), cleanup(), and processEvent().

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

Definition at line 93 of file OgreEventProcessor.h.

Referenced by cleanup(), EventProcessor(), frameStarted(), initialise(), startProcessingEvents(), and stopProcessingEvents().

EventTargetList Ogre::EventProcessor::mEventTargetList [protected]
 

Definition at line 103 of file OgreEventProcessor.h.

Referenced by addEventTarget(), and processEvent().

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

Definition at line 99 of file OgreEventProcessor.h.

Referenced by addCursorMoveListener(), cleanup(), EventProcessor(), frameStarted(), initialise(), and removeCursorMoveListener().

KeyListener* Ogre::KeyTarget::mKeyListener [protected, inherited]
 

Definition at line 51 of file OgreKeyTarget.h.

Referenced by Ogre::KeyTarget::addKeyListener(), Ogre::KeyTarget::KeyTarget(), Ogre::KeyTarget::processKeyEvent(), and Ogre::KeyTarget::removeKeyListener().

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

Definition at line 60 of file OgreMouseTarget.h.

Referenced by Ogre::MouseTarget::addMouseListener(), Ogre::GuiElement::GuiElement(), Ogre::MouseTarget::MouseTarget(), Ogre::MouseTarget::processMouseEvent(), and Ogre::MouseTarget::removeMouseListener().

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

Definition at line 59 of file OgreMouseMotionTarget.h.

Referenced by Ogre::MouseMotionTarget::addMouseMotionListener(), Ogre::MouseMotionTarget::MouseMotionTarget(), Ogre::MouseMotionTarget::processMouseMotionEvent(), and Ogre::MouseMotionTarget::removeMouseMotionListener().

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

Definition at line 63 of file OgreMouseTarget.h.

Referenced by Ogre::MouseTarget::isMouseWithin(), Ogre::MouseTarget::MouseTarget(), and Ogre::MouseTarget::processMouseEvent().

bool Ogre::EventProcessor::mRegisteredAsFrameListener [protected]
 

Definition at line 104 of file OgreEventProcessor.h.

Referenced by EventProcessor(), startProcessingEvents(), and stopProcessingEvents().

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

Definition at line 40 of file OgreEventProcessor.cpp.

Referenced by getSingleton(), and getSingletonPtr().


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

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:50:56 2004