aboutsummaryrefslogtreecommitdiff
path: root/test.jai
blob: 7d031939aa2a45e80f20ef0d2e88f5030f6bfd19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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.
}