summaryrefslogtreecommitdiff
path: root/world/ui.scm
blob: 40d4e690d60fa00720c3424f392a30c712980bd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20


(define (echo-char)
  (define table (make-piece-table "hola"))
  (ui-initialize!)
  (let loop ((char (read-char)))
    (move-cursor! 0 0)
    (cond
      ((char=? #\q char) #f)
      (else (piece-table-insert! table 4 "hola" 'normal)
            (erase-screen!)
            (write-string (piece-table->string table))
            (loop (read-char)))))
  (ui-deinitialize!))

(define (start arguments)
  (with-raw-io (current-input-port) echo-char))

;; Extend `with-raw-io` with the initialization functions and just move to a
;; `with-tui` function that calls the provided thunk in the proper mode