about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-27 21:08:05 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-27 21:08:05 -0800
commitdff7a5226f0c4023aa995efc8e5143d0188924c3 (patch)
tree5c6e8695a6a35631900f9ddc3a9ff77a5b5f6df0
parenta09da47b2a9eb389959440115d591e929f3d06b6 (diff)
downloadteliva-dff7a5226f0c4023aa995efc8e5143d0188924c3.tar.gz
a starting point for new apps
-rw-r--r--template.tlv72
1 files changed, 72 insertions, 0 deletions
diff --git a/template.tlv b/template.tlv
new file mode 100644
index 0000000..faf4131
--- /dev/null
+++ b/template.tlv
@@ -0,0 +1,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]==],
+  },
+}