|
FifeGUI 0.3.0
A C++ GUI library designed for games.
|
#include <keyinput.hpp>
Public Types | |
| enum class | Type : std::uint8_t { Pressed = 0 , Released } |
Public Member Functions | |
| Key const & | getKey () const |
| Type | getType () const |
| bool | isAltPressed () const |
| bool | isControlPressed () const |
| bool | isMetaPressed () const |
| bool | isNumericPad () const |
| bool | isShiftPressed () const |
| KeyInput ()=default | |
| KeyInput (Key const &key, Type type) | |
| void | setAltPressed (bool pressed) |
| void | setControlPressed (bool pressed) |
| void | setKey (Key const &key) |
| void | setMetaPressed (bool pressed) |
| void | setNumericPad (bool numpad) |
| void | setShiftPressed (bool pressed) |
| void | setType (Type type) |
Protected Attributes | |
| bool | mAltPressed {false} |
| bool | mControlPressed {false} |
| Key | mKey |
| bool | mMetaPressed {false} |
| bool | mNumericPad {false} |
| bool | mShiftPressed {false} |
| Type | mType {Type::Pressed} |
Internal class representing raw keyboard input data.
This class is used to represent key input events. It holds information about the key that was pressed or released, the type of the key input event and if any modifier keys were pressed at the same time as the key.
The class is relevant if you want to implement an Input class for a backend.
Definition at line 31 of file keyinput.hpp.
|
strong |
Key input event types.
This enum corresponds to the enum with event types on KeyEvent for easy mapping.
Definition at line 39 of file keyinput.hpp.
| fcn::KeyInput::KeyInput | ( | Key const & | key, |
| Type | type ) |
Constructor.
| key | The key of the key input. |
| type | The type of key input. |
Definition at line 16 of file keyinput.cpp.
| Key const & fcn::KeyInput::getKey | ( | ) | const |
Gets the key of the key input.
Definition at line 41 of file keyinput.cpp.
References mKey.
Referenced by fcn::Gui::handleKeyInput(), and KeyInput().
| KeyInput::Type fcn::KeyInput::getType | ( | ) | const |
Gets the type of the key input.
Definition at line 29 of file keyinput.cpp.
References mType.
Referenced by fcn::Gui::handleKeyInput(), and KeyInput().
| bool fcn::KeyInput::isAltPressed | ( | ) | const |
Checks if alt is pressed.
Definition at line 66 of file keyinput.cpp.
References mAltPressed.
Referenced by fcn::Gui::handleKeyInput(), and KeyInput().
| bool fcn::KeyInput::isControlPressed | ( | ) | const |
Checks if control is pressed.
Definition at line 56 of file keyinput.cpp.
References mControlPressed.
Referenced by fcn::Gui::handleKeyInput(), and KeyInput().
| bool fcn::KeyInput::isMetaPressed | ( | ) | const |
Checks if meta is pressed.
Definition at line 76 of file keyinput.cpp.
References mMetaPressed.
Referenced by fcn::Gui::handleKeyInput(), and KeyInput().
| bool fcn::KeyInput::isNumericPad | ( | ) | const |
Checks if the key was pressed at the numeric pad.
Definition at line 86 of file keyinput.cpp.
References mNumericPad.
Referenced by fcn::Gui::handleKeyInput(), and KeyInput().
| bool fcn::KeyInput::isShiftPressed | ( | ) | const |
Checks if shift is pressed.
Definition at line 46 of file keyinput.cpp.
References mShiftPressed.
Referenced by fcn::Gui::handleKeyInput(), and KeyInput().
| void fcn::KeyInput::setAltPressed | ( | bool | pressed | ) |
Sets the alt to be pressed at the same time as the key, or not.
| pressed | True if alt is pressed at the same time as the key, , false otherwise. |
Definition at line 71 of file keyinput.cpp.
References mAltPressed.
Referenced by KeyInput(), and fcn::sdl3::Input::pushInput().
| void fcn::KeyInput::setControlPressed | ( | bool | pressed | ) |
Sets control to be pressed at the same time as the key, or not.
| pressed | True if control is pressed, false otherwise. |
Definition at line 61 of file keyinput.cpp.
References mControlPressed.
Referenced by KeyInput(), and fcn::sdl3::Input::pushInput().
| void fcn::KeyInput::setKey | ( | Key const & | key | ) |
Sets the key of the key input.
| key | The key of the key input. |
Definition at line 34 of file keyinput.cpp.
References mKey.
Referenced by KeyInput(), fcn::sdl3::Input::pushInput(), fcn::GenericInput::pushKeyPressed(), and fcn::GenericInput::pushKeyReleased().
| void fcn::KeyInput::setMetaPressed | ( | bool | pressed | ) |
Sets meta to be pressed at the same time as the key, or not.
| pressed | True if meta is pressed at the same time as the key, false otherwise. |
Definition at line 81 of file keyinput.cpp.
References mMetaPressed.
Referenced by KeyInput(), and fcn::sdl3::Input::pushInput().
| void fcn::KeyInput::setNumericPad | ( | bool | numpad | ) |
Sets the key to be pressed at the numeric pad.
| numpad | True if the key was pressed at the numeric pad, false otherwise. |
Definition at line 91 of file keyinput.cpp.
References mNumericPad.
Referenced by KeyInput(), and fcn::sdl3::Input::pushInput().
| void fcn::KeyInput::setShiftPressed | ( | bool | pressed | ) |
Sets shift to be pressed at the same time as the key, or not.
| pressed | True if shift is pressed, false otherwise. |
Definition at line 51 of file keyinput.cpp.
References mShiftPressed.
Referenced by KeyInput(), and fcn::sdl3::Input::pushInput().
| void fcn::KeyInput::setType | ( | Type | type | ) |
Sets the type of the key input.
| type | The type of key input. |
Definition at line 22 of file keyinput.cpp.
References mType.
Referenced by KeyInput(), fcn::sdl3::Input::pushInput(), fcn::GenericInput::pushKeyPressed(), and fcn::GenericInput::pushKeyReleased().
|
protected |
True if alt was pressed at the same time as the key, false otherwise.
Definition at line 209 of file keyinput.hpp.
Referenced by isAltPressed(), and setAltPressed().
|
protected |
True if control was pressed at the same time as the key, false otherwise.
Definition at line 203 of file keyinput.hpp.
Referenced by isControlPressed(), and setControlPressed().
|
protected |
Holds the key of the key input.
Definition at line 186 of file keyinput.hpp.
Referenced by getKey(), KeyInput(), and setKey().
|
protected |
True if meta was pressed at the same time as the key, false otherwise.
Definition at line 215 of file keyinput.hpp.
Referenced by isMetaPressed(), and setMetaPressed().
|
protected |
True if the numeric pad was used when the key was pressed, false otherwise.
Definition at line 221 of file keyinput.hpp.
Referenced by isNumericPad(), and setNumericPad().
|
protected |
True if shift was pressed at the same time as the key, false otherwise.
Definition at line 197 of file keyinput.hpp.
Referenced by isShiftPressed(), and setShiftPressed().
|
protected |
Holds the type of the key input.
Definition at line 191 of file keyinput.hpp.
Referenced by getType(), KeyInput(), and setType().