|
FifeGUI 0.2.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::Released} |
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 27 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 35 of file keyinput.hpp.
Constructor.
| key | The key of the key input. |
| type | The type of key input. |
Definition at line 11 of file keyinput.cpp.
| Key const & fcn::KeyInput::getKey | ( | ) | const |
Gets the key of the key input.
Definition at line 28 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 18 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 53 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 43 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 63 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 73 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 33 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 58 of file keyinput.cpp.
References mAltPressed.
Referenced by KeyInput(), and fcn::sdl2::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 48 of file keyinput.cpp.
References mControlPressed.
Referenced by KeyInput(), and fcn::sdl2::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 23 of file keyinput.cpp.
References mKey.
Referenced by KeyInput(), and fcn::sdl2::Input::pushInput().
| 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 68 of file keyinput.cpp.
References mMetaPressed.
Referenced by KeyInput(), and fcn::sdl2::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 78 of file keyinput.cpp.
References mNumericPad.
Referenced by KeyInput(), and fcn::sdl2::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 38 of file keyinput.cpp.
References mShiftPressed.
Referenced by KeyInput(), and fcn::sdl2::Input::pushInput().
| void fcn::KeyInput::setType | ( | Type | type | ) |
Sets the type of the key input.
| type | The type of key input. |
Definition at line 13 of file keyinput.cpp.
References mType.
Referenced by KeyInput(), and fcn::sdl2::Input::pushInput().
|
protected |
True if alt was pressed at the same time as the key, false otherwise.
Definition at line 205 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 199 of file keyinput.hpp.
Referenced by isControlPressed(), and setControlPressed().
|
protected |
Holds the key of the key input.
Definition at line 182 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 211 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 217 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 193 of file keyinput.hpp.
Referenced by isShiftPressed(), and setShiftPressed().
|
protected |
Holds the type of the key input.
Definition at line 187 of file keyinput.hpp.
Referenced by getType(), KeyInput(), and setType().