37 lines
No EOL
854 B
C++
37 lines
No EOL
854 B
C++
#pragma once
|
|
#include <stdint.h>
|
|
|
|
enum class Color : uint8_t {
|
|
Black = 0,
|
|
Blue = 1,
|
|
Green = 2,
|
|
Cyan = 3,
|
|
Red = 4,
|
|
Magenta = 5,
|
|
Brown = 6,
|
|
LightGray = 7,
|
|
DarkGray = 8,
|
|
LightBlue = 9,
|
|
LightGreen = 10,
|
|
LightCyan = 11,
|
|
LightRed = 12,
|
|
LightMagenta = 13,
|
|
Yellow = 14,
|
|
White = 15,
|
|
};
|
|
|
|
struct TextAttr {
|
|
Color fg;
|
|
Color bg;
|
|
|
|
constexpr TextAttr(Color fg = Color::White, Color bg = Color::Black) : fg(fg), bg(bg) {}
|
|
|
|
// Returns the attribute in the high byte, ready to OR with a character value.
|
|
constexpr uint16_t word() const { return (uint16_t)(((uint8_t)bg << 4) | (uint8_t)fg) << 8; }
|
|
};
|
|
|
|
void initFromLow();
|
|
void clear();
|
|
void print(const char* str, TextAttr attr = {});
|
|
void print_dec(uint64_t value, TextAttr attr = {});
|
|
void print_hex(uint64_t value, TextAttr attr = {}); |