FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::sdl2::Input Class Reference

#include <input.hpp>

Inheritance diagram for fcn::sdl2::Input:
fcn::Input

Public Member Functions

void _pollInput () override
KeyInput dequeueKeyInput () override
MouseInput dequeueMouseInput () override
 Input ()
bool isKeyQueueEmpty () override
bool isMouseQueueEmpty () override
virtual void pushInput (SDL_Event event)
Public Member Functions inherited from fcn::Input
 Input (Input &&)=delete
 Input (Input const &)=delete
Input & operator= (Input &&)=delete
Input & operator= (Input const &)=delete

Protected Member Functions

MouseInput::Button convertMouseButton (int button)
int convertSDLEventToFifechanKeyValue (SDL_Event event)

Protected Attributes

std::queue< KeyInputmKeyInputQueue
bool mMouseDown {false}
std::queue< MouseInputmMouseInputQueue
bool mMouseInWindow {false}

Detailed Description

SDL2-specific implementation of Input.

Definition at line 30 of file backends/sdl2/input.hpp.

Constructor & Destructor Documentation

◆ Input()

fcn::sdl2::Input::Input ( )

Constructor.

Definition at line 15 of file input.cpp.

References mMouseInWindow.

Member Function Documentation

◆ _pollInput()

void fcn::sdl2::Input::_pollInput ( )
inlineoverridevirtual

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 fcn::Input.

Definition at line 51 of file backends/sdl2/input.hpp.

◆ convertMouseButton()

MouseInput::Button fcn::sdl2::Input::convertMouseButton ( int button)
protected

Converts a mouse button from SDL to a FifeGUI mouse button.

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

Definition at line 205 of file input.cpp.

Referenced by pushInput().

◆ convertSDLEventToFifechanKeyValue()

int fcn::sdl2::Input::convertSDLEventToFifechanKeyValue ( SDL_Event event)
protected

Converts an SDL event to a FifeGUI key value.

Parameters
eventThe SDL event to convert.
Returns
A FifeGUI key value. -1 if no conversion took place.
See also
Key

Definition at line 228 of file input.cpp.

Referenced by pushInput().

◆ dequeueKeyInput()

KeyInput fcn::sdl2::Input::dequeueKeyInput ( )
overridevirtual

Dequeues the key input queue.

Returns
The first key input in the key input queue.

Implements fcn::Input.

Definition at line 22 of file input.cpp.

References mKeyInputQueue.

◆ dequeueMouseInput()

MouseInput fcn::sdl2::Input::dequeueMouseInput ( )
overridevirtual

Dequeues the mouse input queue.

Returns
The first mouse input in the mouse input queue.

Implements fcn::Input.

Definition at line 41 of file input.cpp.

References mMouseInputQueue.

◆ isKeyQueueEmpty()

bool fcn::sdl2::Input::isKeyQueueEmpty ( )
overridevirtual

Checks if the key queue is empty, or not.

Returns
True if the key queue is empty, false otherwise.

Implements fcn::Input.

Definition at line 17 of file input.cpp.

References mKeyInputQueue.

◆ isMouseQueueEmpty()

bool fcn::sdl2::Input::isMouseQueueEmpty ( )
overridevirtual

Checks if the mouse queue is empyt, or not.

Returns
True if the mouse queue is empty, false otherwise.

Implements fcn::Input.

Definition at line 36 of file input.cpp.

References mMouseInputQueue.

◆ pushInput()

Member Data Documentation

◆ mKeyInputQueue

std::queue<KeyInput> fcn::sdl2::Input::mKeyInputQueue
protected

Queue of key inputs waiting to be processed.

Definition at line 82 of file backends/sdl2/input.hpp.

Referenced by dequeueKeyInput(), isKeyQueueEmpty(), and pushInput().

◆ mMouseDown

bool fcn::sdl2::Input::mMouseDown {false}
protected

True if a mouse button is currently held down.

Definition at line 88 of file backends/sdl2/input.hpp.

Referenced by pushInput().

◆ mMouseInputQueue

std::queue<MouseInput> fcn::sdl2::Input::mMouseInputQueue
protected

Queue of mouse inputs waiting to be processed.

Definition at line 85 of file backends/sdl2/input.hpp.

Referenced by dequeueMouseInput(), isMouseQueueEmpty(), and pushInput().

◆ mMouseInWindow

bool fcn::sdl2::Input::mMouseInWindow {false}
protected

True if the mouse cursor is currently within the application window.

Definition at line 91 of file backends/sdl2/input.hpp.

Referenced by Input(), and pushInput().


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