FifeGUI
0.2.0
A C++ GUI library designed for games.
src
keyinput.cpp
1
// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2
// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3
// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5
#include "fifechan/keyinput.hpp"
6
7
#include "fifechan/key.hpp"
8
9
namespace
fcn
10
{
11
KeyInput::KeyInput
(
Key
const
& key,
Type
type) :
mKey
(key),
mType
(type) { }
12
13
void
KeyInput::setType
(
Type
type)
14
{
15
mType
= type;
16
}
17
18
KeyInput::Type
KeyInput::getType
()
const
19
{
20
return
mType
;
21
}
22
23
void
KeyInput::setKey
(
Key
const
& key)
24
{
25
mKey
= key;
26
}
27
28
Key
const
&
KeyInput::getKey
()
const
29
{
30
return
mKey
;
31
}
32
33
bool
KeyInput::isShiftPressed
()
const
34
{
35
return
mShiftPressed
;
36
}
37
38
void
KeyInput::setShiftPressed
(
bool
pressed)
39
{
40
mShiftPressed
= pressed;
41
}
42
43
bool
KeyInput::isControlPressed
()
const
44
{
45
return
mControlPressed
;
46
}
47
48
void
KeyInput::setControlPressed
(
bool
pressed)
49
{
50
mControlPressed
= pressed;
51
}
52
53
bool
KeyInput::isAltPressed
()
const
54
{
55
return
mAltPressed
;
56
}
57
58
void
KeyInput::setAltPressed
(
bool
pressed)
59
{
60
mAltPressed
= pressed;
61
}
62
63
bool
KeyInput::isMetaPressed
()
const
64
{
65
return
mMetaPressed
;
66
}
67
68
void
KeyInput::setMetaPressed
(
bool
pressed)
69
{
70
mMetaPressed
= pressed;
71
}
72
73
bool
KeyInput::isNumericPad
()
const
74
{
75
return
mNumericPad
;
76
}
77
78
void
KeyInput::setNumericPad
(
bool
numpad)
79
{
80
mNumericPad
= numpad;
81
}
82
}
// namespace fcn
fcn::KeyInput::isAltPressed
bool isAltPressed() const
Checks if alt is pressed.
Definition
keyinput.cpp:53
fcn::KeyInput::setType
void setType(Type type)
Sets the type of the key input.
Definition
keyinput.cpp:13
fcn::KeyInput::Type
Type
Key input event types.
Definition
keyinput.hpp:36
fcn::KeyInput::mMetaPressed
bool mMetaPressed
True if meta was pressed at the same time as the key, false otherwise.
Definition
keyinput.hpp:211
fcn::KeyInput::isNumericPad
bool isNumericPad() const
Checks if the key was pressed at the numeric pad.
Definition
keyinput.cpp:73
fcn::KeyInput::getType
Type getType() const
Gets the type of the key input.
Definition
keyinput.cpp:18
fcn::KeyInput::mControlPressed
bool mControlPressed
True if control was pressed at the same time as the key, false otherwise.
Definition
keyinput.hpp:199
fcn::KeyInput::isControlPressed
bool isControlPressed() const
Checks if control is pressed.
Definition
keyinput.cpp:43
fcn::KeyInput::KeyInput
KeyInput()=default
Constructor.
fcn::KeyInput::setAltPressed
void setAltPressed(bool pressed)
Sets the alt to be pressed at the same time as the key, or not.
Definition
keyinput.cpp:58
fcn::KeyInput::setNumericPad
void setNumericPad(bool numpad)
Sets the key to be pressed at the numeric pad.
Definition
keyinput.cpp:78
fcn::KeyInput::setControlPressed
void setControlPressed(bool pressed)
Sets control to be pressed at the same time as the key, or not.
Definition
keyinput.cpp:48
fcn::KeyInput::setKey
void setKey(Key const &key)
Sets the key of the key input.
Definition
keyinput.cpp:23
fcn::KeyInput::mNumericPad
bool mNumericPad
True if the numeric pad was used when the key was pressed, false otherwise.
Definition
keyinput.hpp:217
fcn::KeyInput::mShiftPressed
bool mShiftPressed
True if shift was pressed at the same time as the key, false otherwise.
Definition
keyinput.hpp:193
fcn::KeyInput::mKey
Key mKey
Holds the key of the key input.
Definition
keyinput.hpp:182
fcn::KeyInput::isMetaPressed
bool isMetaPressed() const
Checks if meta is pressed.
Definition
keyinput.cpp:63
fcn::KeyInput::setMetaPressed
void setMetaPressed(bool pressed)
Sets meta to be pressed at the same time as the key, or not.
Definition
keyinput.cpp:68
fcn::KeyInput::setShiftPressed
void setShiftPressed(bool pressed)
Sets shift to be pressed at the same time as the key, or not.
Definition
keyinput.cpp:38
fcn::KeyInput::mType
Type mType
Holds the type of the key input.
Definition
keyinput.hpp:187
fcn::KeyInput::getKey
Key const & getKey() const
Gets the key of the key input.
Definition
keyinput.cpp:28
fcn::KeyInput::isShiftPressed
bool isShiftPressed() const
Checks if shift is pressed.
Definition
keyinput.cpp:33
fcn::KeyInput::mAltPressed
bool mAltPressed
True if alt was pressed at the same time as the key, false otherwise.
Definition
keyinput.hpp:205
fcn::Key
Represents a keyboard key or character code.
Definition
key.hpp:20
Generated by
1.16.1