aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/TUI/module.jai17
-rw-r--r--ttt.jai2
2 files changed, 10 insertions, 9 deletions
diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai
index 7c9d7b1..3843cd7 100644
--- a/modules/TUI/module.jai
+++ b/modules/TUI/module.jai
@@ -1,4 +1,4 @@
-#module_parameters(COLOR_BIT_DEPTH := 24); // TODO - Do #assert module parameters to make sure they are valid... and maybe rename to: COLOR_MODE with a enum.
+#module_parameters(COLOR_MODE := 24);
#if OS == {
case .LINUX;
@@ -67,10 +67,10 @@ Commands :: struct {
SetWindowTitle :: "\e]0;%\e\\";
- RefreshWindow :: "\e[7t"; // TODO Not yet tested.
-
- SetIEC2022 :: "\e%@";
- SetUTF8 :: "\e%G";
+ RefreshWindow :: "\e[7t"; // TODO Not yet tested. Is this required?
+
+ SetIEC2022 :: "\e%@"; // TODO Remove this!?
+ SetUTF8 :: "\e%G"; // TODO Remove this!?
SetGraphicsRendition :: "\e[%m";
@@ -106,7 +106,7 @@ Commands :: struct {
QueryWindowSizeInChars :: "\e[18t"; // Emits the window size as: "ESC [ 8 <r> ; <c> t" Where <r> = row and <c> = column. TODO Does not work on windows.
}
-#if COLOR_BIT_DEPTH == 4 {
+#if COLOR_MODE == 4 {
#load "palette_4b.jai";
set_colors :: inline (foreground: Palette, background: Palette) {
@@ -115,7 +115,7 @@ Commands :: struct {
cast(u8)foreground + 30, cast(u8)background + 40);
}
}
-else #if COLOR_BIT_DEPTH == 8 {
+else #if COLOR_MODE == 8 {
#load "palette_8b.jai";
set_colors :: inline (foreground: Palette, background: Palette) {
@@ -144,7 +144,7 @@ else {
#add_context tui_style: Style;
Style :: struct {
- #if COLOR_BIT_DEPTH == 4 || COLOR_BIT_DEPTH == 8 {
+ #if COLOR_MODE == 4 || COLOR_MODE == 8 {
background: Palette = .BLACK;
foreground: Palette = .WHITE;
} else {
@@ -272,6 +272,7 @@ input_string : string;
input_override : Key;
#run {
+ assert(COLOR_MODE == 4 || COLOR_MODE == 8 || COLOR_MODE == 24, "Invalid COLOR_MODE. Valid values are 4, 8, or 24 (default).");
assert(input_buffer.count >= KEY_SIZE, "The input buffer size must be capable to hold an entire Key, which should be able to hold an UTF8 code (4 bytes) or a terminal escape code (6 bytes).");
}
diff --git a/ttt.jai b/ttt.jai
index ffe9494..13c9fcf 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -26,7 +26,7 @@
#import "String";
#import "Integer_Saturating_Arithmetic";
#import "UTF8";
-TUI :: #import "TUI"(COLOR_BIT_DEPTH=4);
+TUI :: #import "TUI"(COLOR_MODE=4);
VERSION :: "2.0"; // Use only 3 chars (to fit layouts).
YEAR :: "2024";