This repository has been archived on 2022-05-26. You can view files and clone it, but cannot push or open issues or pull requests.
calculator/src/debug.cpp

29 lines
No EOL
692 B
C++

#ifdef DEBUG
#ifndef __DEBUG_CPP
#define __DEBUG_CPP
#include "cursor.cpp"
/**
* @brief Prints value of pressed key in top left corner.
* Additionally it can get offet to see more presses.
*
* @param _key char that we got.
*/
void debugKey(cursor::key _key) {
static unsigned short offset = 0;
cursor::savePosition();
cursor::setPosition(1, 1);
// std::cout << " "; // clear debug corner :^)
cursor::setPosition(offset++ * 4 + 1, 1);
std::cout << "\033[31;1m";
// if control flag set
if (_key.special != 0)
std::cout << "^";
std::cout << int(_key.code);
std::cout << "\033[0m";
cursor::restorePosition();
}
#endif
#endif