Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

InputHandler Class Reference

Inheritance diagram for InputHandler:

Inheritance graph
[legend]
Collaboration diagram for InputHandler:

Collaboration graph
[legend]

Detailed Description

Handle input events.

Events:

Pressed keys are stored in m_pressed array, this array is shared and updated by InputAgent.

Definition at line 20 of file InputHandler.h.

Public Member Functions

 InputHandler ()
void takePressed (Uint8 *pressed)
void mouseState (const V2 &loc, Uint8 buttons)
virtual void keyEvent (const KeyStroke &)
virtual void mouseEvent (const MouseStroke &)
virtual bool isPressed (SDLKey key) const
virtual bool isLeftPressed () const
virtual bool isMiddlePressed () const
virtual bool isRightPressed () const
virtual V2 getMouseLoc () const
virtual std::string toString () const


Constructor & Destructor Documentation

InputHandler::InputHandler  ) 
 

Definition at line 14 of file InputHandler.cpp.

00015 : m_mouseLoc(-1, -1)
00016 {
00017     m_pressed = NULL;
00018     m_buttons = 0;
00019 }


Member Function Documentation

virtual V2 InputHandler::getMouseLoc  )  const [inline, virtual]
 

Implements InputProvider.

Definition at line 37 of file InputHandler.h.

00037 { return m_mouseLoc; }

bool InputHandler::isLeftPressed  )  const [virtual]
 

Implements InputProvider.

Definition at line 35 of file InputHandler.cpp.

00036 {
00037     return m_buttons & SDL_BUTTON(1);
00038 }

bool InputHandler::isMiddlePressed  )  const [virtual]
 

Implements InputProvider.

Definition at line 41 of file InputHandler.cpp.

00042 {
00043     return m_buttons & SDL_BUTTON(2);
00044 }

bool InputHandler::isPressed SDLKey  key  )  const [virtual]
 

Implements InputProvider.

Definition at line 29 of file InputHandler.cpp.

00030 {
00031     return m_pressed && m_pressed[key];
00032 }

bool InputHandler::isRightPressed  )  const [virtual]
 

Implements InputProvider.

Definition at line 47 of file InputHandler.cpp.

00048 {
00049     return m_buttons & SDL_BUTTON(3);
00050 }

virtual void InputHandler::keyEvent const KeyStroke  )  [inline, virtual]
 

Reimplemented in StateInput.

Definition at line 30 of file InputHandler.h.

00030 {}

virtual void InputHandler::mouseEvent const MouseStroke  )  [inline, virtual]
 

Reimplemented in LevelInput, PedoInput, WorldInput, HelpInput, OptionsInput, and DemoInput.

Definition at line 31 of file InputHandler.h.

00031 {}

void InputHandler::mouseState const V2 loc,
Uint8  buttons
 

Definition at line 22 of file InputHandler.cpp.

00023 {
00024     m_mouseLoc = loc;
00025     m_buttons = buttons;
00026 }

void InputHandler::takePressed Uint8 *  pressed  )  [inline]
 

Definition at line 27 of file InputHandler.h.

00027 { m_pressed = pressed; }

std::string InputHandler::toString  )  const [virtual]
 

Implements InputProvider.

Definition at line 53 of file InputHandler.cpp.

00054 {
00055     return ExInfo("input")
00056         .addInfo("mouse", m_mouseLoc.toString())
00057         .addInfo("buttons", m_buttons).info();
00058 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:55:24 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2