Skip to content

KeyTracker

TechnologicalTurtle edited this page Jul 20, 2026 · 6 revisions

KeyTracker

KeyTracker is used for 'advanced' (advanced means, that the program finds when was the key pressed and released) key tracking.

Initialization

You shouldn't initialize KeyTracker yourself, as it's initialized automatically with parent window.

Usage

void Track(...)

Tell it to track key you want by using function Track(), there are three good (good excludes void Track(int key)) ways to do it:

// using char value
MyWindow.key_tracker.Track('A');

// using FunctionalKey_ enum
MyWindow.key_tracker.Track(LibGui::FunctionalKey_Up);

// or adding multiple keys at one
MyWindow.key_tracker.Track({'A', LibGui::FunctionalKey_Up});

Tip

The optional update parameter determines, if the function will update itself after adding the key.

Getting the information

Use operator[] to get key out of this KeyTracker in form of KeyStatus:

if (MyWindow.key_tracker['A'].clicked)
   std::cout << "'A' pressed\n";

Clone this wiki locally