From 7112e3cf675d94df2e1e546bb44902c5dfcf19fb Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Thu, 2 May 2024 13:09:40 +0200 Subject: [PATCH] . --- main.odin | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/main.odin b/main.odin index 3e4d05e..e46b776 100644 --- a/main.odin +++ b/main.odin @@ -1,15 +1,14 @@ package main import "core:fmt" -import "core:os" import "core:strings" +import "core:time" -WIDTH :: 32 -HEIGHT :: 32 +WIDTH :: 128 +HEIGHT :: 128 AREA :: WIDTH * HEIGHT main :: proc() { - fmt.println("hellope") board : [AREA]bool = --- // board[0] = true @@ -18,40 +17,31 @@ main :: proc() { // for x in 4..<14 { // board[x + WIDTH*8] = true // } + fmt.print("\e[2J") // clear screen for { + fmt.print("\e[u") // reset cursor print_board(&board) - bytes := 0 - err : os.Errno - buf : [3]byte - for { - bytes, err = os.read(os.stdin, buf[:]) - if bytes > 0 do break - } update_board(&board) + time.sleep(time.Millisecond * 50) } } print_board :: proc(state: ^[AREA]bool){ - fmt.println(strings.repeat("-", WIDTH)) for y := 0; y < HEIGHT; y += 2{ + line := strings.builder_make() for x in 0.. 2) - // fmt.println("count %v, state %v", count, new_cell) new_state[x + y * WIDTH] = new_cell } }