FuncDoodle
Loading...
Searching...
No Matches
FuncDoodle::KeyMask Class Reference

Bitmask representing a set of ImGui keys. More...

#include <Keybinds.h>

Public Member Functions

 KeyMask ()
 Creates an empty key mask.
 KeyMask (ImGuiKey key)
 Creates a key mask containing a single ImGui key.
 KeyMask (const KeyMask &other)=default
 Copies another key mask.
bool IsPressed () const
 Returns whether every key in the mask is currently pressed.
 operator char * () const
 Converts the key mask to a display string.
void Reset ()
 Clears all keys from the mask.
std::vector< ImGuiKey > All () const
 Returns all keys currently stored in the mask.
KeyMask operator| (const KeyMask &other) const
 Returns a key mask containing keys from both operands.
bool operator== (const KeyMask &other) const
 Returns whether two key masks contain the same keys.

Private Attributes

unsigned long long m_Keys [KEY_MASK_SIZE]

Detailed Description

Bitmask representing a set of ImGui keys.

Stores keys internally as bits, allowing efficient storage and comparison of multiple key states. Key combinations are created using bitwise OR rather than direct multi-key construction.

Used for representing keyboard input states such as shortcuts.

Invariant
Each ImGuiKey maps to exactly one bit in m_Keys.

Constructor & Destructor Documentation

◆ KeyMask() [1/3]

FuncDoodle::KeyMask::KeyMask ( )

Creates an empty key mask.

◆ KeyMask() [2/3]

FuncDoodle::KeyMask::KeyMask ( ImGuiKey key)

Creates a key mask containing a single ImGui key.

Parameters
keyKey to set in the mask.

◆ KeyMask() [3/3]

FuncDoodle::KeyMask::KeyMask ( const KeyMask & other)
default

Copies another key mask.

Parameters
otherKey mask to copy.

Member Function Documentation

◆ All()

std::vector< ImGuiKey > FuncDoodle::KeyMask::All ( ) const
inlinenodiscard

Returns all keys currently stored in the mask.

Returns
Vector of ImGui keys contained in the mask.

◆ IsPressed()

bool FuncDoodle::KeyMask::IsPressed ( ) const
nodiscard

Returns whether every key in the mask is currently pressed.

Returns
Whether the masked key set is active.

◆ operator char *()

FuncDoodle::KeyMask::operator char * ( ) const

Converts the key mask to a display string.

Returns
C string describing the keys in the mask.

◆ operator==()

bool FuncDoodle::KeyMask::operator== ( const KeyMask & other) const
inline

Returns whether two key masks contain the same keys.

Parameters
otherKey mask to compare against.
Returns
Whether both masks are equal.

◆ operator|()

KeyMask FuncDoodle::KeyMask::operator| ( const KeyMask & other) const

Returns a key mask containing keys from both operands.

Parameters
otherKey mask to merge with this one.
Returns
Combined key mask.

◆ Reset()

void FuncDoodle::KeyMask::Reset ( )
inline

Clears all keys from the mask.

Member Data Documentation

◆ m_Keys

unsigned long long FuncDoodle::KeyMask::m_Keys[KEY_MASK_SIZE]
private

The documentation for this class was generated from the following files: