FifeGUI 0.3.0
A C++ GUI library designed for games.
fcn::sdl3::Input Class Reference

#include <input.hpp>

Inheritance diagram for fcn::sdl3::Input:
fcn::Input

Public Member Functions

void _pollInput () override
KeyInput dequeueKeyInput () override
MouseInput dequeueMouseInput () override
std::string dequeueTextInput () override
 Input ()
bool isKeyQueueEmpty () override
bool isMouseQueueEmpty () override
bool isTextQueueEmpty () 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

Static Protected Member Functions

static MouseInput::Button convertMouseButton (int button)

Protected Attributes

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

Detailed Description

SDL3-specific implementation of Input.

Definition at line 36 of file backends/sdl3/input.hpp.

Constructor & Destructor Documentation

◆ Input()

fcn::sdl3::Input::Input ( )

Constructor.

Definition at line 21 of file input.cpp.

References mMouseInWindow.

Member Function Documentation

◆ _pollInput()

void fcn::sdl3::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 57 of file backends/sdl3/input.hpp.

◆ convertMouseButton()

MouseInput::Button fcn::sdl3::Input::convertMouseButton ( int button)
staticprotected

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

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

Definition at line 176 of file input.cpp.

Referenced by pushInput().

◆ dequeueKeyInput()

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

Dequeues the key input queue.

Returns
The first key input in the key input queue.

Implements fcn::Input.

Definition at line 30 of file input.cpp.

References mKeyInputQueue, and fcn::throwException().

◆ dequeueMouseInput()

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

Dequeues the mouse input queue.

Returns
The first mouse input in the mouse input queue.

Implements fcn::Input.

Definition at line 49 of file input.cpp.

References mMouseInputQueue, and fcn::throwException().

◆ dequeueTextInput()

std::string fcn::sdl3::Input::dequeueTextInput ( )
overridevirtual

Dequeues a UTF-8 text string from the text input queue.

Base implementation returns an empty string. Override in backends that support text input (e.g. SDL3).

Returns
The UTF-8 text string.

Reimplemented from fcn::Input.

Definition at line 68 of file input.cpp.

References mTextInputQueue.

◆ isKeyQueueEmpty()

bool fcn::sdl3::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 25 of file input.cpp.

References mKeyInputQueue.

◆ isMouseQueueEmpty()

bool fcn::sdl3::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 44 of file input.cpp.

References mMouseInputQueue.

◆ isTextQueueEmpty()

bool fcn::sdl3::Input::isTextQueueEmpty ( )
overridevirtual

Checks if the text input queue is empty.

Base implementation returns true (no text queue). Override in backends that support text input (e.g. SDL3).

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

Reimplemented from fcn::Input.

Definition at line 63 of file input.cpp.

References mTextInputQueue.

◆ pushInput()

Member Data Documentation

◆ mKeyInputQueue

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

Queue of key inputs waiting to be processed.

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

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

◆ mMouseDown

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

True if a mouse button is currently held down.

Definition at line 94 of file backends/sdl3/input.hpp.

Referenced by pushInput().

◆ mMouseInputQueue

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

Queue of mouse inputs waiting to be processed.

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

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

◆ mMouseInWindow

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

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

Definition at line 97 of file backends/sdl3/input.hpp.

Referenced by Input(), and pushInput().

◆ mTextInputQueue

std::queue<std::string> fcn::sdl3::Input::mTextInputQueue
protected

Queue of text input strings waiting to be processed.

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

Referenced by dequeueTextInput(), isTextQueueEmpty(), and pushInput().


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