gcn::GLUTInput Class Reference

#include <glutinput.hpp>

Inheritance diagram for gcn::GLUTInput:

gcn::Input List of all members.

Detailed Description

GLUT implementation of Input.

Definition at line 75 of file glutinput.hpp.

Public Member Functions

 GLUTInput ()
 Constructor.
virtual void pushKeyDownInput (unsigned char key)
 Pushes a key down.
virtual void pushKeyUpInput (unsigned char key)
 Pushes a key up.
virtual void pushSpecialDownInput (unsigned char key)
 Pushes a special key down.
virtual void pushSpecialUpInput (unsigned char key)
 Pushes a special key up.
virtual void pushMouseInput (int button, int state, int x, int y)
 Pushes a mouse input.
virtual void pushMotionInput (int x, int y)
 Pushes a mouse motion input.
virtual void pushPassiveMotionInput (int x, int y)
 Pushes a passive mouse motion input.
virtual void _pollInput ()
 Polls all input.
virtual bool isKeyQueueEmpty ()
 Checks whether the key queue is empty or not.
virtual KeyInput dequeueKeyInput ()
 Dequeues the key input queue.
virtual bool isMouseQueueEmpty ()
 Checks whether the mouse queue is empyt or not.
virtual MouseInput dequeueMouseInput ()
 Dequeues the mouse input queue.

Protected Member Functions

Key convertKeyCharacter (unsigned char key)
 Converts a GLUT key to a Key object.
Key convertSpecialCharacter (unsigned char key)
 Converts a special GLUT key to a Key object.
int convertMouseButton (int button)
 Converts a mouse button from GLUT to a Guichan mouse button representation.

Protected Attributes

std::queue< KeyInputmKeyInputQueue
std::queue< MouseInputmMouseInputQueue


Member Function Documentation

virtual void gcn::GLUTInput::_pollInput (  )  [inline, virtual]

Polls all input.

It exists for input driver compatibility. If you only use GLUT and plan sticking with GLUT you can safely ignore this function as it in the GLUT case does nothing.

Implements gcn::Input.

Definition at line 150 of file glutinput.hpp.

Key gcn::GLUTInput::convertKeyCharacter ( unsigned char  key  )  [protected]

Converts a GLUT key to a Key object.

Parameters:
key a GLUT key.
Returns:
a Key object.

Definition at line 178 of file glutinput.cpp.

References gcn::Key::setAltPressed(), gcn::Key::setControlPressed(), gcn::Key::setShiftPressed(), and gcn::Key::setValue().

Referenced by pushKeyDownInput(), and pushKeyUpInput().

int gcn::GLUTInput::convertMouseButton ( int  button  )  [protected]

Converts a mouse button from GLUT to a Guichan mouse button representation.

Parameters:
button a GLUT mouse button.
Returns:
a Guichan mouse button.

Definition at line 297 of file glutinput.cpp.

Referenced by pushMouseInput().

Key gcn::GLUTInput::convertSpecialCharacter ( unsigned char  key  )  [protected]

Converts a special GLUT key to a Key object.

Parameters:
key a GLUT key.
Returns:
a Key object.

Definition at line 211 of file glutinput.cpp.

References gcn::Key::setAltPressed(), gcn::Key::setControlPressed(), gcn::Key::setShiftPressed(), and gcn::Key::setValue().

Referenced by pushSpecialDownInput(), and pushSpecialUpInput().

KeyInput gcn::GLUTInput::dequeueKeyInput (  )  [virtual]

Dequeues the key input queue.

Returns:
key input.

Implements gcn::Input.

Definition at line 76 of file glutinput.cpp.

References mKeyInputQueue.

MouseInput gcn::GLUTInput::dequeueMouseInput (  )  [virtual]

Dequeues the mouse input queue.

Returns:
mouse input.

Implements gcn::Input.

Definition at line 96 of file glutinput.cpp.

References mMouseInputQueue.

bool gcn::GLUTInput::isKeyQueueEmpty (  )  [virtual]

Checks whether the key queue is empty or not.

Returns:
true if the key queue is empty.

Implements gcn::Input.

Definition at line 71 of file glutinput.cpp.

References mKeyInputQueue.

bool gcn::GLUTInput::isMouseQueueEmpty (  )  [virtual]

Checks whether the mouse queue is empyt or not.

Returns:
true if the mouse queue is empty.

Implements gcn::Input.

Definition at line 91 of file glutinput.cpp.

References mMouseInputQueue.

void gcn::GLUTInput::pushKeyDownInput ( unsigned char  key  )  [virtual]

Pushes a key down.

It should be called in the glutKeyboardFunc call back function.

Parameters:
key a key from GLUT.

Definition at line 111 of file glutinput.cpp.

References convertKeyCharacter(), mKeyInputQueue, gcn::KeyInput::setKey(), and gcn::KeyInput::setType().

void gcn::GLUTInput::pushKeyUpInput ( unsigned char  key  )  [virtual]

Pushes a key up.

It should be called in the glutKeyboardUpFunc call back function.

Parameters:
key a key from GLUT.

Definition at line 119 of file glutinput.cpp.

References convertKeyCharacter(), mKeyInputQueue, gcn::KeyInput::setKey(), and gcn::KeyInput::setType().

void gcn::GLUTInput::pushMotionInput ( int  x,
int  y 
) [virtual]

Pushes a mouse motion input.

It should be called in the glutMotionFunc call back function.

Parameters:
x an x coordinate from GLUT.
y an y coordinate from GLUT.

Definition at line 163 of file glutinput.cpp.

References mMouseInputQueue, gcn::MouseInput::setButton(), gcn::MouseInput::setType(), gcn::MouseInput::x, and gcn::MouseInput::y.

Referenced by pushPassiveMotionInput().

void gcn::GLUTInput::pushMouseInput ( int  button,
int  state,
int  x,
int  y 
) [virtual]

Pushes a mouse input.

It should be called in the glutMouseFunc call back function.

Parameters:
button a button from GLUT.
state a mouse state from GLUT.
x an x coordinate from GLUT.
y an y coordinate from GLUT.

Definition at line 144 of file glutinput.cpp.

References convertMouseButton(), mMouseInputQueue, gcn::MouseInput::setButton(), gcn::MouseInput::setType(), gcn::MouseInput::x, and gcn::MouseInput::y.

void gcn::GLUTInput::pushPassiveMotionInput ( int  x,
int  y 
) [virtual]

Pushes a passive mouse motion input.

It should be called in the glutPassiveMotionFunc call back function.

Parameters:
x an x coordinate from GLUT.
y an y coordinate from GLUT.

Definition at line 173 of file glutinput.cpp.

References pushMotionInput().

void gcn::GLUTInput::pushSpecialDownInput ( unsigned char  key  )  [virtual]

Pushes a special key down.

It should be called in the glutSpecialFunc call back function.

Parameters:
key a key from GLUT.

Definition at line 127 of file glutinput.cpp.

References convertSpecialCharacter(), mKeyInputQueue, gcn::KeyInput::setKey(), and gcn::KeyInput::setType().

void gcn::GLUTInput::pushSpecialUpInput ( unsigned char  key  )  [virtual]

Pushes a special key up.

It should be called in the glutSpecialUpFunc call back function.

Parameters:
key a key from GLUT.

Definition at line 136 of file glutinput.cpp.

References convertSpecialCharacter(), mKeyInputQueue, gcn::KeyInput::setKey(), and gcn::KeyInput::setType().


The documentation for this class was generated from the following files:
Generated on Sat Jul 29 19:38:48 2006 for Guichan by  doxygen 1.4.7