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

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

◆ SDLInput()

gcn::SDLInput::SDLInput ( )

Constructor.

Member Function Documentation

◆ _pollInput()

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.

◆ convertKeyCharacter()

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

Converts an SDL keysym to a Key object.

Parameters
keyan SDL keysym
Returns
a Key object.

◆ convertMouseButton()

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.

◆ dequeueKeyInput()

KeyInput gcn::SDLInput::dequeueKeyInput ( )
virtual

Dequeues the key input queue.

Returns
a KeyInput object.
See also
KeyInput

Implements gcn::Input.

◆ dequeueMouseInput()

MouseInput gcn::SDLInput::dequeueMouseInput ( )
virtual

Dequeues the mouse input queue.

Returns
a MouseInput object.
See also
MouseInput

Implements gcn::Input.

◆ isKeyQueueEmpty()

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.

◆ isMouseQueueEmpty()

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.

◆ processKeyRepeat()

void gcn::SDLInput::processKeyRepeat ( )
virtual

◆ pushInput()

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

◆ mIsRepeating

bool gcn::SDLInput::mIsRepeating
protected

◆ mKeyInputQueue

std::queue<KeyInput> gcn::SDLInput::mKeyInputQueue
protected

◆ mLastKey

Key gcn::SDLInput::mLastKey
protected

◆ mMouseDown

bool gcn::SDLInput::mMouseDown
protected

◆ mMouseInputQueue

std::queue<MouseInput> gcn::SDLInput::mMouseInputQueue
protected

◆ mMouseInWindow

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.