about summary refs log tree commit diff stats
path: root/template.tlv
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-02 22:18:26 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-03-02 22:18:26 -0800
commit81849716faf31397dce443c3fa28723d22ac6d5a (patch)
tree3c314fba27a3d5ffcd6ecec10a3227aa90d7380b /template.tlv
parent68d956e31af9f4230b6a6ecfa9a53b5513d408aa (diff)
downloadteliva-81849716faf31397dce443c3fa28723d22ac6d5a.tar.gz
fake keyboard constructor
Diffstat (limited to 'template.tlv')
-rw-r--r--template.tlv34
1 files changed, 34 insertions, 0 deletions
diff --git a/template.tlv b/template.tlv
index a0aa31a..0df691f 100644
--- a/template.tlv
+++ b/template.tlv
@@ -264,3 +264,37 @@
     >To show a brief description of the app on the 'big picture' screen, put the text in a special buffer called 'doc:blurb'.
     >
     >You can also override the default big picture screen entirely by creating a buffer called 'doc:main'.
+- __teliva_timestamp: original
+  window:
+    >-- constructor for fake screen and window
+    >-- call it like this:
+    >--   local w = window{
+    >--     kbd=kbd('abc'),
+    >--     scr=scr{h=5, w=4},
+    >--   }
+    >-- eventually it'll do everything a real ncurses window can
+    >function window(h)
+    >  h.__index = h
+    >  setmetatable(h, h)
+    >  h.__index = function(table, key)
+    >    return rawget(h, key)
+    >  end
+    >  h.getch = function(self)
+    >    return table.remove(h.kbd, 1)
+    >  end
+    >  return h
+    >end
+- __teliva_timestamp: original
+  kbd:
+    >function kbd(keys)
+    >  local result = {}
+    >  for i=1,string.len(keys) do
+    >    table.insert(result, keys[i])
+    >  end
+    >  return result
+    >end
+- __teliva_timestamp: original
+  scr:
+    >function scr(props)
+    >  return props
+    >end