-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestit.lua
More file actions
45 lines (33 loc) · 777 Bytes
/
testit.lua
File metadata and controls
45 lines (33 loc) · 777 Bytes
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
tb = require "termbox"
if not tb.init() then
print("FAIL: tb_init")
return
end
cell = {}
cell.ch = ' '
cell.fg = tb.WHITE
cell.bg = tb.GREEN
tb.change_cell(5,5,'X',tb.RED,tb.WHITE) -- no return val
tb.put_cell(3,2,cell)
cells = {}
repeat table.insert(cells, cell) until #cells == 10
tb.blit(0,7,10,1,cells) -- no return val
tb.present() -- no return val
t={}
repeat
et=tb.peek_event(t,1000)
if et==tb.EVENT_KEY then
tb.change_cell(5,5,'K',tb.WHITE,tb.YELLOW)
elseif et==tb.EVENT_RESIZE then
tb.change_cell(5,5,'R',tb.WHITE,tb.BLUE)
else
tb.change_cell(5,5,'X',tb.WHITE,tb.RED)
end
tb.present()
if t.ch == 'q' then break end
until not et
-- wait for ANY event
tb.clear()
tb.present()
tb.poll_event(t)
tb.shutdown() -- no return val