summaryrefslogtreecommitdiff
path: root/world/ui.scm
blob: 757e7ddea6b46fc508817ba0e0ae4d4eaa2160f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(define (tui-loop)
  (define table (make-piece-table "hola"))
  (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))))))

(define (call-with-tui thunk)
  (dynamic-wind
    tui-initialize!
    (lambda () (with-raw-io (current-input-port) thunk))
    tui-deinitialize!))

(define (run arguments)
  (call-with-tui tui-loop))