From 39d3a3c542bf2848abda61185c1fb5b68de31031 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sun, 12 Nov 2023 18:47:47 +0000 Subject: h --- ui.ha | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 ui.ha (limited to 'ui.ha') diff --git a/ui.ha b/ui.ha deleted file mode 100644 index 31a1865..0000000 --- a/ui.ha +++ /dev/null @@ -1,39 +0,0 @@ -use fmt; -use io; -use os; -use unix::tty; - -fn clear() void = { - fmt::fprint(os::stdout_file, "\x1b[H\x1b[2J\x1b[3J")!; -}; - -fn put_at(x: int, y: int, s: str) void = { - // 0 indexed! - fmt::fprintf(os::stdout_file, "\x1b[{};{}H{}", y+1,x+1, s)!; -}; - -fn get_key() u8 = { - // bad - let b = [0u8]; - io::read(os::stdin_file, b)!; - return b[0]; -}; - -fn setup_term() tty::termios = { - const term = tty::termios_query(os::stdin_file)!; - tty::makeraw(&term)!; - - // alternate screen, hide cursor - fmt::fprint(os::stdout_file, "\x1b[?1049h\x1b[?25l")!; - - clear(); - - return term; -}; - -fn finish_term(term: *tty::termios) void = { - // normal screen, show cursor - fmt::fprint(os::stdout_file, "\x1b[?1049l\x1b[?25h")!; - - tty::termios_restore(term); -}; -- cgit v1.2.3