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

#include <genericinput.hpp>

Inheritance diagram for fcn::GenericInput:
fcn::Input

Public Member Functions

void _pollInput () override
KeyInput dequeueKeyInput () override
MouseInput dequeueMouseInput () override
bool isKeyQueueEmpty () override
bool isMouseQueueEmpty () override
void pushKeyPressed (int unicode)
void pushKeyReleased (int unicode)
void pushMouseButtonPressed (int x, int y, int button)
void pushMouseButtonReleased (int x, int y, int button)
void pushMouseMoved (int x, int y)
void pushMouseWheelMovedDown (int x, int y)
void pushMouseWheelMovedLeft (int x, int y)
void pushMouseWheelMovedRight (int x, int y)
void pushMouseWheelMovedUp (int x, int y)
Public Member Functions inherited from fcn::Input
virtual std::string dequeueTextInput ()
 Input (Input &&)=delete
 Input (Input const &)=delete
virtual bool isTextQueueEmpty ()
Input & operator= (Input &&)=delete
Input & operator= (Input const &)=delete

Protected Attributes

std::queue< KeyInputmKeyInputQueue
std::queue< MouseInputmMouseInputQueue

Detailed Description

A generic input implementation usable with various backends.

Definition at line 25 of file genericinput.hpp.

Member Function Documentation

◆ _pollInput()

void fcn::GenericInput::_pollInput ( )
overridevirtual

Polls all existing input.

Called when input should be polled.

Note
Provided for compatibility with backend libraries that require input polling at a fixed update rate.

Implements fcn::Input.

Definition at line 148 of file genericinput.cpp.

◆ dequeueKeyInput()

KeyInput fcn::GenericInput::dequeueKeyInput ( )
overridevirtual

Dequeues the key input queue.

Returns
The first key input in the key input queue.

Implements fcn::Input.

Definition at line 115 of file genericinput.cpp.

References mKeyInputQueue, and fcn::throwException().

◆ dequeueMouseInput()

MouseInput fcn::GenericInput::dequeueMouseInput ( )
overridevirtual

Dequeues the mouse input queue.

Returns
The first mouse input in the mouse input queue.

Implements fcn::Input.

Definition at line 134 of file genericinput.cpp.

References mMouseInputQueue, and fcn::throwException().

◆ isKeyQueueEmpty()

bool fcn::GenericInput::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 110 of file genericinput.cpp.

References mKeyInputQueue.

◆ isMouseQueueEmpty()

bool fcn::GenericInput::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 129 of file genericinput.cpp.

References mMouseInputQueue.

◆ pushKeyPressed()

void fcn::GenericInput::pushKeyPressed ( int unicode)

Pushes a key pressed event.

Note
If a special key is pressed, like the F1 key, the corresponding GUI key value found in the enum in Key should be pushed as the unicode value.
Parameters
unicodeThe unicode value of the key.

Definition at line 20 of file genericinput.cpp.

References mKeyInputQueue, fcn::KeyInput::setKey(), and fcn::KeyInput::setType().

◆ pushKeyReleased()

void fcn::GenericInput::pushKeyReleased ( int unicode)

Pushes a key released event.

Note
If a special key is pressed, like the F1 key, the corresponding GUI key value found in the enum in Key should be pushed as the unicode value.
Parameters
unicodeThe unicode value of the key.

Definition at line 29 of file genericinput.cpp.

References mKeyInputQueue, fcn::KeyInput::setKey(), and fcn::KeyInput::setType().

◆ pushMouseButtonPressed()

void fcn::GenericInput::pushMouseButtonPressed ( int x,
int y,
int button )

Pushes a mouse button pressed event.

Parameters
xThe x coordinate of the mouse event.
yThe y coordinate of the mouse event.
buttonThe button of the mouse event.

Definition at line 38 of file genericinput.cpp.

References mMouseInputQueue, fcn::MouseInput::setButton(), fcn::MouseInput::setType(), fcn::MouseInput::setX(), and fcn::MouseInput::setY().

◆ pushMouseButtonReleased()

void fcn::GenericInput::pushMouseButtonReleased ( int x,
int y,
int button )

Pushes a mouse button released event.

Parameters
xThe x coordinate of the mouse event.
yThe y coordinate of the mouse event.
buttonThe button of the mouse event.

Definition at line 49 of file genericinput.cpp.

References mMouseInputQueue, fcn::MouseInput::setButton(), fcn::MouseInput::setType(), fcn::MouseInput::setX(), and fcn::MouseInput::setY().

◆ pushMouseMoved()

void fcn::GenericInput::pushMouseMoved ( int x,
int y )

Pushes a mouse moved event.

Parameters
xThe x coordinate of the mouse event.
yThe y coordinate of the mouse event.

Definition at line 100 of file genericinput.cpp.

References mMouseInputQueue, fcn::MouseInput::setType(), fcn::MouseInput::setX(), and fcn::MouseInput::setY().

◆ pushMouseWheelMovedDown()

void fcn::GenericInput::pushMouseWheelMovedDown ( int x,
int y )

Pushes a mouse wheel moved down event.

Parameters
xThe x coordinate of the mouse event.
yThe y coordinate of the mouse event.

Definition at line 70 of file genericinput.cpp.

References mMouseInputQueue, fcn::MouseInput::setType(), fcn::MouseInput::setX(), and fcn::MouseInput::setY().

◆ pushMouseWheelMovedLeft()

void fcn::GenericInput::pushMouseWheelMovedLeft ( int x,
int y )

Pushes a mouse wheel moved left event.

Parameters
xThe x coordinate of the mouse event.
yThe y coordinate of the mouse event.

Definition at line 90 of file genericinput.cpp.

References mMouseInputQueue, fcn::MouseInput::setType(), fcn::MouseInput::setX(), and fcn::MouseInput::setY().

◆ pushMouseWheelMovedRight()

void fcn::GenericInput::pushMouseWheelMovedRight ( int x,
int y )

Pushes a mouse wheel moved right event.

Parameters
xThe x coordinate of the mouse event.
yThe y coordinate of the mouse event.

Definition at line 80 of file genericinput.cpp.

References mMouseInputQueue, fcn::MouseInput::setType(), fcn::MouseInput::setX(), and fcn::MouseInput::setY().

◆ pushMouseWheelMovedUp()

void fcn::GenericInput::pushMouseWheelMovedUp ( int x,
int y )

Pushes a mouse wheel moved up event.

Parameters
xThe x coordinate of the mouse event.
yThe y coordinate of the mouse event.

Definition at line 60 of file genericinput.cpp.

References mMouseInputQueue, fcn::MouseInput::setType(), fcn::MouseInput::setX(), and fcn::MouseInput::setY().

Member Data Documentation

◆ mKeyInputQueue

std::queue<KeyInput> fcn::GenericInput::mKeyInputQueue
protected

Holds the key input queue.

Definition at line 128 of file genericinput.hpp.

Referenced by dequeueKeyInput(), isKeyQueueEmpty(), pushKeyPressed(), and pushKeyReleased().

◆ mMouseInputQueue

std::queue<MouseInput> fcn::GenericInput::mMouseInputQueue
protected

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