82 operator char*()
const;
89 for (
unsigned long long& m_Key :
m_Keys) {
100 [[nodiscard]] std::vector<ImGuiKey>
All()
const {
101 std::vector<ImGuiKey> keys;
105 for (
int j = 0; j < 64; j++) {
106 if (
m_Keys[i] & (1ull << j)) {
107 auto key = (ImGuiKey)((i * 64) + j);
168 Shortcut(
bool requiresCtrl,
bool requiresShift,
bool requiresSuper,
197 operator char*()
const;
293 std::vector<std::pair<const char*, ShortcutWithUser>>&
GetAll();
296 std::vector<std::pair<const char*, ShortcutWithUser>>
m_Reg;
Bitmask representing a set of ImGui keys.
Definition Keybinds.h:51
bool operator==(const KeyMask &other) const
Returns whether two key masks contain the same keys.
Definition Keybinds.h:128
KeyMask()
Creates an empty key mask.
Definition Keybinds.cc:15
std::vector< ImGuiKey > All() const
Returns all keys currently stored in the mask.
Definition Keybinds.h:100
KeyMask operator|(const KeyMask &other) const
Returns a key mask containing keys from both operands.
Definition Keybinds.cc:76
bool IsPressed() const
Returns whether every key in the mask is currently pressed.
Definition Keybinds.cc:31
KeyMask(const KeyMask &other)=default
Copies another key mask.
void Reset()
Clears all keys from the mask.
Definition Keybinds.h:88
unsigned long long m_Keys[KEY_MASK_SIZE]
Definition Keybinds.h:137
KeybindsRegistry(std::filesystem::path rootPath)
Creates a keybind registry rooted at a configuration directory.
Definition Keybinds.cc:185
~KeybindsRegistry()
Definition Keybinds.cc:187
void End()
Finalizes registration and loads any user overrides.
Definition Keybinds.cc:205
Shortcut Get(const char *id)
Returns the effective shortcut registered for an identifier.
Definition Keybinds.cc:191
std::filesystem::path m_RootPath
Definition Keybinds.h:297
void Register(const char *id, Shortcut shortcut)
Registers a default shortcut for an identifier.
Definition Keybinds.cc:200
std::vector< std::pair< const char *, ShortcutWithUser > > m_Reg
Definition Keybinds.h:296
std::vector< std::pair< const char *, ShortcutWithUser > > & GetAll()
Returns all registered keybind entries.
Definition Keybinds.cc:256
void Write()
Persists user keybind overrides to disk.
Definition Keybinds.cc:234
The FuncDoodle C++ namespace.
Definition Common.h:12
constexpr int KEY_MASK_SIZE
Number of 64-bit slots required to store all named ImGui keys.
Definition Keybinds.h:37
Stores a default shortcut and an optional user-defined one.
Definition Keybinds.h:228
Shortcut Default
Built-in shortcut shipped by the application.
Definition Keybinds.h:233
std::optional< Shortcut > User
Optional user override loaded from configuration.
Definition Keybinds.h:238
Keyboard shortcut definition (key + mods).
Definition Keybinds.h:149
bool RequiresSuper
Whether Super/Meta must be held.
Definition Keybinds.h:185
Shortcut()
Creates an empty shortcut.
Definition Keybinds.cc:84
bool operator==(const Shortcut &other) const
Returns whether two shortcuts are identical.
Definition Keybinds.h:211
KeyMask Key
Primary key mask for the shortcut.
Definition Keybinds.h:190
bool RequiresShift
Whether Shift must be held.
Definition Keybinds.h:180
bool IsPressed() const
Returns whether the full shortcut is active.
Definition Keybinds.cc:178
bool RequiresCtrl
Whether Ctrl must be held.
Definition Keybinds.h:175