FifeGUI 0.2.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
 Input (Input &&)=delete
 Input (Input const &)=delete
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 24 of file genericinput.hpp.

Member Function Documentation

◆ _pollInput()

void fcn::GenericInput::_pollInput ( )
overridevirtual

Polls all exsisting input.

Called when input should be polled. The function exists for compatibility reason where some libraries need to poll input at a certain logic rate.

Implements fcn::Input.

Definition at line 135 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 102 of file genericinput.cpp.

References mKeyInputQueue.

◆ 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 121 of file genericinput.cpp.

References mMouseInputQueue.

◆ 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 97 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 116 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 15 of file genericinput.cpp.

◆ 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 20 of file genericinput.cpp.

◆ 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 25 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 36 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 87 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 57 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 77 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 67 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 47 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 127 of file genericinput.hpp.

Referenced by dequeueKeyInput(), and isKeyQueueEmpty().

◆ mMouseInputQueue

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

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