"#" "io_blockchar" store @defun "io_pos_windowstart" { #puts: x y origin_x origin_y } @defun "io_pos_windowend" { #puts: x y ntiles_x padding_x 2 * + tile_sizex * origin_x + ntiles_y padding_y 2 * + tile_sizey * origin_y + } @defun "io_pos_after" { #puts: x y 0 ntiles_y padding_y 2 * + tile_sizey * origin_y + } @defun "io_clearscreen" { "\x1B[2J\x1B[H" print } @defun "io_goto" { #args: x y "y" store "x" store #"going to (" x + "," + y + ")" + print "\x1B[" y 1 + + ";" + x 1 + + "H" + print } @defun "io_box" { #args: x y w h; w/h are the distances from edge to edge #stackdump #1000000 sleep "h" store "w" store "y" store "x" store x y io_goto "+" print 0 dup w < while "-" print 1 + dup w < end pop "+" print #1000000 sleep #"x = " print x print #"y = " print y print x y h + io_goto "+" print 0 dup w < while "-" print 1 + dup w < end pop "+" print #1000000 sleep #"x = " print x print #"y = " print y print x y 1 + io_goto 0 dup h 1 - < while "|\x1B[D\x1B[B" print #bar, left, down 1 + dup h 1 - < end pop #1000000 sleep x w + 1 + y 1 + io_goto 0 dup h 1 - < while "|\x1B[D\x1B[B" print #bar, left, down 1 + dup h 1 - < end pop #1000000 sleep } @defun "io_windowbox" { io_pos_windowstart io_pos_windowend io_pos_windowstart diff2 2 2 diff2 io_box } @defun "io_square" { #args: x y "y" store "x" store x y io_goto #"+--+" print #x y 1 + io_goto #"| |" print #x y 2 + io_goto #"+--+" print io_blockchar dup dup + + dup "\x1B[3D\x1B[B" swap + + print } @defun "io_pos_square" { #args: x y swap tile_sizex * padding_x + origin_x + swap tile_sizey * padding_y + origin_y + } @defun "io_gsquare" { #args: x y blockidx "b_blockclrs" swapoutvar swap arridx swap "b_blockclrs" gstore io_setcolour io_pos_square io_square io_resetcolour } @defun "io_setcolour" { #args: coloridx [0..7] "\x1B[3" swap + "m" + print } @defun "io_resetcolour" { "\x1B[0m" print } @defun "io_printheader" { 0 0 io_goto "##### ##### ##### #### ### ####\n # # # # # # #\n # #### # #### # ###\n # # # # # # #\n # ##### # # # ### ####" print }