FifeGUI 0.2.0
A C++ GUI library designed for games.
key.hpp
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#ifndef INCLUDE_FIFECHAN_KEY_HPP_
6#define INCLUDE_FIFECHAN_KEY_HPP_
7
8#include <cstdint>
9
10#include "fifechan/platform.hpp"
11
12namespace fcn
13{
19 class FIFEGUI_API Key
20 {
21 public:
27 explicit Key(int value = 0);
28
35 bool isCharacter() const;
36
43 bool isNumber() const;
44
51 bool isLetter() const;
52
59 int getValue() const;
60
67 bool operator==(Key const & key) const;
68
75 bool operator!=(Key const & key) const;
76
80 enum : std::int16_t
81 {
82 Space = ' ',
83 Tab = '\t',
84 Enter = '\n',
85 LeftAlt = -1000,
86 RightAlt,
87 LeftShift,
88 RightShift,
89 LeftControl,
90 RightControl,
91 LeftMeta,
92 RightMeta,
93 LeftSuper,
94 RightSuper,
95 Insert,
96 Home,
97 PageUp,
98 Delete,
99 End,
100 PageDown,
101 Escape,
102 CapsLock,
103 Backspace,
104 F1,
105 F2,
106 F3,
107 F4,
108 F5,
109 F6,
110 F7,
111 F8,
112 F9,
113 F10,
114 F11,
115 F12,
116 F13,
117 F14,
118 F15,
119 PrintScreen,
120 ScrollLock,
121 Pause,
122 NumLock,
123 AltGr,
124 Left,
125 Right,
126 Up,
127 Down,
128 At
129 };
130
131 protected:
137 };
138} // namespace fcn
139
140#endif // INCLUDE_FIFECHAN_KEY_HPP_
Key(int value=0)
Constructor.
Definition key.cpp:9
int getValue() const
Gets the value of the key.
Definition key.cpp:28
bool isLetter() const
Checks if a key is a letter.
Definition key.cpp:21
int mValue
Holds the value of the key.
Definition key.hpp:136
bool operator!=(Key const &key) const
Compares two keys.
Definition key.cpp:38
bool isNumber() const
Checks if a key is a number.
Definition key.cpp:16
bool isCharacter() const
Checks if a key is a character.
Definition key.cpp:11
bool operator==(Key const &key) const
Compares two keys.
Definition key.cpp:33