-
Notifications
You must be signed in to change notification settings - Fork 0
KeyTracker
TechnologicalTurtle edited this page Jul 20, 2026
·
6 revisions
KeyTracker is used for 'advanced' (advanced means, that the program finds when was the key pressed and released) key tracking.
You shouldn't initialize KeyTracker yourself, as it's initialized automatically with parent window.
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.
Use operator[] to get key out of this KeyTracker in form of KeyStatus:
if (MyWindow.key_tracker['A'].clicked)
std::cout << "'A' pressed\n";Features