JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
KeyboardShortcut.hpp
Go to the documentation of this file.
1// Copyright 2025 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#include "input.hpp"
8
9#include <variant>
10
11namespace jngl {
12
15public:
18
22 KeyboardShortcut(key::KeyType modifier, char key);
23
28 KeyboardShortcut(key::KeyType modifier1, key::KeyType modifier2, char key);
29
32
37
41 bool pressed() const;
42
43private:
44 bool ctrl = false;
45 bool shift = false;
46 bool alt = false;
48};
49
50} // namespace jngl
Represents a keyboard shortcut, e.g. Ctrl+S
KeyboardShortcut(key::KeyType modifier, char key)
Modifier + key, e.g.
std::string toString() const
Used to display the shortcut, e.g.
KeyboardShortcut(key::KeyType key)
Single key, e.g. jngl::key::F1.
KeyboardShortcut(key::KeyType modifier1, key::KeyType modifier2, char key)
Two modifiers + key, e.g.
bool pressed() const
Returns true if all modifiers and the key of the shortcut was pressed in this step.
KeyboardShortcut()
No shortcut, will never trigger.
Input related functions.
KeyType
Keyboard keys.
Definition input.hpp:25
JNGL's main namespace.