aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ttt.jai12
-rw-r--r--tui.jai24
2 files changed, 28 insertions, 8 deletions
diff --git a/ttt.jai b/ttt.jai
index 53a3e01..8ac98c8 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -21,7 +21,7 @@
#import "System";
#import "Sort";
#import "Math";
-#import "POSIX";
+// #import "POSIX";
#import "File";
#import "File_Utilities";
#import "String";
@@ -1186,10 +1186,14 @@ main :: () {
// https://github.com/MicrosoftDocs/Console-Docs/blob/main/docs/console-virtual-terminal-sequences.md
TUI.start();
TUI.clear_screen();
- TUI.draw_box(1,1,13,13);
- sleep_milliseconds(10000);
- write_string(TUI.Commands.ShowCursor);
+ TUI.draw_box(1,1,24,13);
+ // TODO get size of console... its being displayed... but we want to collect it.
+ // write_string(TUI.Commands.QueryCursorPosition);
+ write_string(TUI.Commands.QueryWindowSizeInChars);
+ sleep_milliseconds(3000);
+ // write_string(TUI.Commands.ShowCursor);
TUI.stop();
+ // write_string(TUI.Commands.QueryDeviceAttributes);
return;
str: string;
diff --git a/tui.jai b/tui.jai
index a0eb025..3c868ee 100644
--- a/tui.jai
+++ b/tui.jai
@@ -12,6 +12,16 @@ Drawings :: struct {
TeeB :: "\x76";
TeeT :: "\x77";
LineV :: "\x78";
+
+ Blank :: "\x5F";
+ Diamond :: "\x60";
+ Checkerboard :: "\x61";
+ PlusMinus :: "\x67";
+ LessThanOrEqual :: "\x79";
+ GreaterThanOrEqual :: "\x7A";
+ Pi :: "\x7B";
+ NotEqual :: "\x7C";
+ CenteredDot :: "\x7E";
}
Commands :: struct {
@@ -21,6 +31,11 @@ Commands :: struct {
EnterDrawingMode :: "\e(0";
EnterNormalMode :: "\e(B";
ClearScreen :: "\e[2J";
+ ClearLine :: "\e[2K";
+
+ RefreshWindow :: "\e[7t"; // TODO Not yet tested.
+
+ SetUTF8 :: "\e%G"; // TODO TEST ME PLEASE
// Cursor Visibility
ShowCursor :: "\e[?25h";
@@ -44,21 +59,22 @@ Commands :: struct {
CursorNormalMode :: "\e[?1l";
// Query State
- QueryCursorPos :: "\e[6n"; // Emits the cursor position as: ESC [ <r> ; <c> R Where <r> = row and <c> = column.
+ QueryCursorPosition :: "\e[6n"; // Emits the cursor position as: "ESC [ <r> ; <c> R" Where <r> = row and <c> = column.
QueryDeviceAttributes :: "\e[0c";
+ QueryWindowSizeInChars :: "\e[18t"; // Emits the window size as: "ESC [ 8 <r> ; <c> t" Where <r> = row and <c> = column.
+
}
start :: () {
- write_string(Commands.EnterAlternateBuffer);
+ write_strings(Commands.EnterAlternateBuffer, Commands.SetUTF8, Commands.HideCursor);
}
stop :: () {
- write_string(Commands.EnterMainBuffer);
+ write_strings(Commands.EnterMainBuffer, Commands.ShowCursor);
}
draw_box :: (x: int, y: int, width: int, height: int, to_standard_error := false) {
- write_string(Commands.HideCursor);
write_strings(
// Commands.EnterNormalMode,
Commands.EnterDrawingMode,