about summary refs log tree commit diff stats
path: root/template.tlv
blob: faf41312f4abbc6d2c86b5a1d1f1e7c255d38002 (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
teliva_program = {
  {
    __teliva_timestamp = [==[
original]==],
    window = [==[
window = curses.stdscr()]==],
  },
  {
    __teliva_timestamp = [==[
original]==],
    render = [==[
function render(window)
  window:clear()
  -- draw stuff to screen here
  window:attron(curses.A_BOLD)
  window:mvaddstr(1, 5, "example app")
  window:attrset(curses.A_NORMAL)
  for i=0,15 do
    window:attrset(curses.color_pair(i))
    window:mvaddstr(3+i, 5, "========================")
  end
  curses.refresh()
end]==],
  },
  {
    __teliva_timestamp = [==[
original]==],
    menu = [==[
menu = {}]==],
  },
  {
    __teliva_timestamp = [==[
original]==],
    update = [==[
function update(window)
  local key = curses.getch()
  -- process key here
end]==],
  },
  {
    init_colors = [==[
function init_colors()
  for i=0,7 do
    curses.init_pair(i, i, -1)
  end
  curses.init_pair(8, 7, 0)
  curses.init_pair(9, 7, 1)
  curses.init_pair(10, 7, 2)
  curses.init_pair(11, 7, 3)
  curses.init_pair(12, 7, 4)
  curses.init_pair(13, 7, 5)
  curses.init_pair(14, 7, 6)
  curses.init_pair(15, -1, 15)
end]==],
    __teliva_timestamp = [==[
original]==],
  },
  {
    main = [==[
function main()
  init_colors()

  while true do
    render(window)
    update(window)
  end
end
]==],
    __teliva_timestamp = [==[
original]==],
  },
}