From 709879ee56d31fe543a0ad882713bd4e3d17d2d2 Mon Sep 17 00:00:00 2001 From: dam Date: Thu, 17 Aug 2023 20:28:47 +0100 Subject: Added kscurses and testing program. --- test.jai | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test.jai (limited to 'test.jai') diff --git a/test.jai b/test.jai new file mode 100644 index 0000000..7d03193 --- /dev/null +++ b/test.jai @@ -0,0 +1,45 @@ +#import "Basic"; +#import "kscurses"; + +main :: () { + + // use_ks_curses(); + // run_singlethread_ui(); + pos: ivec2 = .{}; + + ks_init(); + key: Key = 0; + mode := make_graphics_mode(); + while(key != .CTRL_C && key != #char "q") { + // ks_print :: inline (coord : ivec2, mode : Graphics_Mode, fmt : string, args : ..Any) { + mode.attr_flags |= .F_BOLD; + ks_print(pos, mode, " wow % wow", 333); + mode.attr_flags &= ~.F_BOLD; + new_pos := pos; + new_pos.x += 6; + ks_print(new_pos, mode, "∞"); + // print("BAZINGA\n"); + key = ks_getch(); + if key == { + case .UP; pos.y -= 1; + case .DOWN; pos.y += 1; + case .LEFT; pos.x -= 1; + case .RIGHT; pos.x += 1; + } + if pos.y < 0 then pos.y = 0; + if pos.x < 0 then pos.x = 0; + ks_move_cursor(pos); + ks_clear_screen(); + + _x := 80; + _y := 24; + box: Ibox2 = .{}; + box.width = xx _x; + box.height = xx _y; + box.size = .{x = xx _x, y = xx _y}; + box.corner = .{x=0, y=0}; + ks_box(box); + } + ks_terminate(); + if key == .CTRL_C then print("WOWOWOWOWOWO\n"); // TODO CTRL_C exits without passing here. +} -- cgit v1.2.3