Mana
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
SDLInput Class Reference

SDL implementation of Input. More...

#include <sdlinput.h>

Inheritance diagram for SDLInput:

Public Member Functions

 SDLInput ()
 Constructor.
 
virtual void pushInput (SDL_Event event)
 Pushes an SDL event.
 
void _pollInput () override
 Polls all input.
 
bool isKeyQueueEmpty () override
 
gcn::KeyInput dequeueKeyInput () override
 
bool isMouseQueueEmpty () override
 
gcn::MouseInput dequeueMouseInput () override
 
bool isTextQueueEmpty () const
 
TextInput dequeueTextInput ()
 

Static Protected Member Functions

static int convertMouseButton (int button)
 Converts a mouse button from SDL to a Guichan mouse button representation.
 
static int convertKeyCharacter (SDL_Event event)
 Converts an SDL event key to a key value.
 

Protected Attributes

std::queue< gcn::KeyInput > mKeyInputQueue
 
std::queue< gcn::MouseInput > mMouseInputQueue
 
std::queue< TextInputmTextInputQueue
 
bool mMouseDown = false
 

Detailed Description

SDL implementation of Input.

Definition at line 142 of file sdlinput.h.

Constructor & Destructor Documentation

◆ SDLInput()

SDLInput::SDLInput ( )
default

Constructor.

Member Function Documentation

◆ _pollInput()

void SDLInput::_pollInput ( )
inlineoverride

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.

Definition at line 164 of file sdlinput.h.

◆ convertKeyCharacter()

int SDLInput::convertKeyCharacter ( SDL_Event  event)
staticprotected

Converts an SDL event key to a key value.

Parameters
eventan SDL event with a key to convert.
Returns
a key value.
See also
Key

Definition at line 256 of file sdlinput.cpp.

◆ convertMouseButton()

int SDLInput::convertMouseButton ( int  button)
staticprotected

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

Parameters
buttonan SDL mouse button.
Returns
a Guichan mouse button.

Definition at line 240 of file sdlinput.cpp.

◆ dequeueKeyInput()

gcn::KeyInput SDLInput::dequeueKeyInput ( )
override

Definition at line 71 of file sdlinput.cpp.

◆ dequeueMouseInput()

gcn::MouseInput SDLInput::dequeueMouseInput ( )
override

Definition at line 91 of file sdlinput.cpp.

◆ dequeueTextInput()

TextInput SDLInput::dequeueTextInput ( )

Definition at line 111 of file sdlinput.cpp.

◆ isKeyQueueEmpty()

bool SDLInput::isKeyQueueEmpty ( )
override

Definition at line 66 of file sdlinput.cpp.

◆ isMouseQueueEmpty()

bool SDLInput::isMouseQueueEmpty ( )
override

Definition at line 86 of file sdlinput.cpp.

◆ isTextQueueEmpty()

bool SDLInput::isTextQueueEmpty ( ) const

Definition at line 106 of file sdlinput.cpp.

◆ pushInput()

void 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.

Definition at line 132 of file sdlinput.cpp.

Member Data Documentation

◆ mKeyInputQueue

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

Definition at line 200 of file sdlinput.h.

◆ mMouseDown

bool SDLInput::mMouseDown = false
protected

Definition at line 204 of file sdlinput.h.

◆ mMouseInputQueue

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

Definition at line 201 of file sdlinput.h.

◆ mTextInputQueue

std::queue<TextInput> SDLInput::mTextInputQueue
protected

Definition at line 202 of file sdlinput.h.


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