Mouse Class Reference

#include <Mouse.h>

Inheritance diagram for Mouse:

EventListener Object

List of all members.

Public Member Functions

void registerListener (MouseListener *listener)
 Registers a mouse listener.
void unregisterListener (MouseListener *listener)
 Unregisters a mouse listener.
void processEvent (SDL_Event &event)
 Enables the class to respond to SDL events.
buttonStategetButtons ()
 Getter for the button states.
GLuint & getX ()
 Getter for the x coordinate.
GLuint & getY ()
 Getter for the y coordinate.
GLint & getXRel ()
 Getter for the relative x Coordinate.
GLint & getYRel ()
 Getter for the relative y coordinate.
void setButtons (const buttonState &buttons)
 Setter for the Button states.
void setX (const GLuint &x)
 Setter for the x coordinate.
void setY (const GLuint &y)
 Setter for the y coordinate.
void setXRel (const GLint &xRel)
 Setter for the relative x coordinate.
void setYRel (const GLint &yRel)
 Setter for the relative y coordinate.
void setSelected (const GLuint &selectId)
 Removes selection.
virtual string toString () const
 Returns a textual representation.
virtual string className () const
 Returns the class name of the object.
virtual enum classId classId () const
 Returns the class id of the object.

Static Public Member Functions

static MousegetInstance ()
 The singleton getter.

Private Member Functions

 Mouse ()
 The constructor.
 Mouse (const Mouse &source)
 The copy constructor.
 ~Mouse ()
 The destructor.

Private Attributes

vector< MouseListener * > listeners
buttonState buttons
 The state of the buttons.
GLuint x
 The position of the Mouse in x direction.
GLuint y
 The position of the Mouse in y direction.
GLint xRel
 The relative position of the Mouse in x direction.
GLint yRel
 The relative p osition of the Mouse in y direction.
GLuint selectId
 The id of the last selected object.

Static Private Attributes

static Mouseinstance = 0
 The singleton instance.


Constructor & Destructor Documentation

Mouse::Mouse (  )  [private]

The constructor.

Initializes the mouse class.

Mouse::Mouse ( const Mouse source  )  [private]

The copy constructor.

Should not be called.

Mouse::~Mouse (  )  [private]

The destructor.

Destroyes the mouse instance Should only be called for program termination.


Member Function Documentation

Mouse * Mouse::getInstance (  )  [static]

The singleton getter.

The only way to access the mouse class

void Mouse::registerListener ( MouseListener listener  ) 

Registers a mouse listener.

Adds a new MouseListener to be informed of all mouse events. Does nothing if the listener is allready present.

Parameters:
listener The listener to be registered

void Mouse::unregisterListener ( MouseListener listener  ) 

Unregisters a mouse listener.

void Mouse::processEvent ( SDL_Event &  event  )  [virtual]

Enables the class to respond to SDL events.

Implements EventListener.

buttonState & Mouse::getButtons (  ) 

Getter for the button states.

GLuint & Mouse::getX (  ) 

Getter for the x coordinate.

GLuint & Mouse::getY (  ) 

Getter for the y coordinate.

GLint & Mouse::getXRel (  ) 

Getter for the relative x Coordinate.

GLint & Mouse::getYRel (  ) 

Getter for the relative y coordinate.

void Mouse::setButtons ( const buttonState buttons  ) 

Setter for the Button states.

void Mouse::setX ( const GLuint &  x  ) 

Setter for the x coordinate.

void Mouse::setY ( const GLuint &  y  ) 

Setter for the y coordinate.

void Mouse::setXRel ( const GLint &  xRel  ) 

Setter for the relative x coordinate.

void Mouse::setYRel ( const GLint &  yRel  ) 

Setter for the relative y coordinate.

void Mouse::setSelected ( const GLuint &  selectedId  ) 

Removes selection.

This function is called by the renderer each frame BEFORE rendering.

string Mouse::toString (  )  const [virtual]

Returns a textual representation.

Returns:
a string descriping the run-time object

Implements EventListener.

string Mouse::className (  )  const [virtual]

Returns the class name of the object.

Returns:
a string with the name of the object's class

Implements EventListener.

enum classId Mouse::classId (  )  const [virtual]

Returns the class id of the object.

Returns:
an id of the object's class

Implements EventListener.


Member Data Documentation

Mouse * Mouse::instance = 0 [static, private]

The singleton instance.

vector<MouseListener*> Mouse::listeners [private]

The state of the buttons.

GLuint Mouse::x [private]

The position of the Mouse in x direction.

GLuint Mouse::y [private]

The position of the Mouse in y direction.

GLint Mouse::xRel [private]

The relative position of the Mouse in x direction.

GLint Mouse::yRel [private]

The relative p osition of the Mouse in y direction.

GLuint Mouse::selectId [private]

The id of the last selected object.


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

Generated on Mon Jul 7 13:30:34 2008 for Firefly by  doxygen 1.5.6