From 11d82bde639289b0839783d47a67a06829b0b25a Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Wed, 6 Dec 2023 15:57:55 -0500 Subject: [PATCH] try to help #132 also added a bit of docs --- src/tiv.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/tiv.cpp b/src/tiv.cpp index a012a93..78b7bfe 100644 --- a/src/tiv.cpp +++ b/src/tiv.cpp @@ -77,10 +77,10 @@ // Implementation of flag representation for flags in the main() method constexpr int FLAG_FG = 1; constexpr int FLAG_BG = 2; -constexpr int FLAG_MODE_256 = 4; -constexpr int FLAG_24BIT = 8; -constexpr int FLAG_NOOPT = 16; -constexpr int FLAG_TELETEXT = 32; +constexpr int FLAG_MODE_256 = 4; // Limit colors to 256-color mode +constexpr int FLAG_24BIT = 8; // 24-bit color mode +constexpr int FLAG_NOOPT = 16; // Only use the same half-block character +constexpr int FLAG_TELETEXT = 32; // Use teletext characters // Steps (@TODO: Figure out what exactly they represent) constexpr int COLOR_STEP_COUNT = 6; @@ -212,6 +212,12 @@ constexpr unsigned int BITMAPS[] = { 0, 1 // End marker for extended TELETEXT mode. }; +/** + * @brief Struct to represent a character to be drawn. + * @param fgColor RGB + * @param bgColor RGB + * @param codePoint The code point of the character to be drawn. + */ struct CharData { std::array fgColor = std::array{0, 0, 0}; std::array bgColor = std::array{0, 0, 0}; @@ -399,7 +405,7 @@ int clamp_byte(int value) { double sqr(double n) { return n * n; } -int best_index(int value, const int (&STEPS)[], int count) { +int best_index(int value, const int STEPS[], int count) { int best_diff = std::abs(STEPS[0] - value); int result = 0; for (int i = 1; i < count; i++) {