_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gcn::SDLInput Class Reference

#include <sdlinput.h>

Inheritance diagram for gcn::SDLInput:
gcn::Input

Public Member Functions

 SDLInput ()
 
virtual void pushInput (SDL_Event event)
 
virtual void _pollInput ()
 
virtual bool isKeyQueueEmpty ()
 
virtual KeyInput dequeueKeyInput ()
 
virtual bool isMouseQueueEmpty ()
 
virtual MouseInput dequeueMouseInput ()
 
virtual void processKeyRepeat ()
 
- Public Member Functions inherited from gcn::Input
virtual ~Input ()
 

Static Public Member Functions

static Key convertKeyCharacter (SDL_keysym key)
 

Protected Member Functions

int convertMouseButton (int button)
 

Protected Attributes

std::queue< KeyInputmKeyInputQueue
 
std::queue< MouseInputmMouseInputQueue
 
bool mMouseDown
 
bool mMouseInWindow
 
Key mLastKey
 
bool mIsRepeating
 

Detailed Description

SDL implementation of Input.

Constructor & Destructor Documentation

gcn::SDLInput::SDLInput ( )

Constructor.

Member Function Documentation

virtual void gcn::SDLInput::_pollInput ( )
inlinevirtual

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

Implements gcn::Input.

Key gcn::SDLInput::convertKeyCharacter ( SDL_keysym  key)
static

Converts an SDL keysym to a Key object.

Parameters
keyan SDL keysym
Returns
a Key object.
int gcn::SDLInput::convertMouseButton ( int  button)
protected

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

Parameters
buttonan SDL mouse button.
Returns
a Guichan button.
KeyInput gcn::SDLInput::dequeueKeyInput ( )
virtual

Dequeues the key input queue.

Returns
a KeyInput object.
See also
KeyInput

Implements gcn::Input.

MouseInput gcn::SDLInput::dequeueMouseInput ( )
virtual

Dequeues the mouse input queue.

Returns
a MouseInput object.
See also
MouseInput

Implements gcn::Input.

bool gcn::SDLInput::isKeyQueueEmpty ( )
virtual

Checks whether the key queue is empty or not.

Returns
true if the key queue is empty.

Implements gcn::Input.

bool gcn::SDLInput::isMouseQueueEmpty ( )
virtual

Checks whether the mouse queue is empyt or not.

Returns
true if the mouse queue is empty.

Implements gcn::Input.

void gcn::SDLInput::processKeyRepeat ( )
virtual
void gcn::SDLInput::pushInput ( SDL_Event  event)
virtual

Pushes an SDL event. It should be called at least once per frame to update input with user input.

Parameters
eventan event from SDL.

Member Data Documentation

bool gcn::SDLInput::mIsRepeating
protected
std::queue<KeyInput> gcn::SDLInput::mKeyInputQueue
protected
Key gcn::SDLInput::mLastKey
protected
bool gcn::SDLInput::mMouseDown
protected
std::queue<MouseInput> gcn::SDLInput::mMouseInputQueue
protected
bool gcn::SDLInput::mMouseInWindow
protected

The documentation for this class was generated from the following files:
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.