aboutsummaryrefslogtreecommitdiffstats
path: root/lib/gui.moon
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-03-02 19:08:48 +0000
committers-ol <s-ol@users.noreply.github.com>2020-03-02 19:09:56 +0000
commitc26b90317cb67ddcf71237e1d2f5fad87a5a3191 (patch)
tree3577416ff058cbd5e955c33693684a2b78c0c364 /lib/gui.moon
parentfind IO via Result tree, not Registry (diff)
downloadalive-c26b90317cb67ddcf71237e1d2f5fad87a5a3191.tar.gz
alive-c26b90317cb67ddcf71237e1d2f5fad87a5a3191.zip
document more interfaces
Diffstat (limited to 'lib/gui.moon')
-rw-r--r--lib/gui.moon76
1 files changed, 0 insertions, 76 deletions
diff --git a/lib/gui.moon b/lib/gui.moon
deleted file mode 100644
index 474de5c..0000000
--- a/lib/gui.moon
+++ /dev/null
@@ -1,76 +0,0 @@
-assert love, "this module only works from within love2d!"
-{ graphics: lg, keyboard: lk } = love
-
-import Op from require 'core'
-import Copilot from require 'copilot'
-import Logger from require 'logger'
-
-class out extends Op
- @doc: "(out name-str value) - show the output
-
-display value as a bar"
-
- setup: (name, @chld) =>
- @@instances[@name] = nil if @name
- @name = name\const!\unwrap!
- @@instances[@name] = @
-
- update: (dt) =>
- @value = @chld\unwrap!
-
- destroy: =>
- @@instances[@name] = nil
-
- MARGIN = 16
- WIDTH = 24
- HEIGHT = 120
- @instances: {}
- @draw_all: ->
- outs = [name for name in pairs @@instances]
- table.sort outs
-
- x = MARGIN
- lg.setColor 1, 1, 1
- for name in *outs
- value = @@instances[name].value * HEIGHT
- lg.rectangle 'line', x, MARGIN, WIDTH, HEIGHT
- lg.rectangle 'fill', x, MARGIN + HEIGHT - value, WIDTH, value
- lg.print name, x, MARGIN + HEIGHT + MARGIN
- x += WIDTH + MARGIN
-
-class key extends Op
- @doc: "(key name-str) - gate from keypress"
-
- setup: (@key) =>
- assert @key
- @out = Stream 'bool', false
- @out
-
- update: (dt) =>
- @out\set lk.isDown @key\unwrap!
-
-arguments, k = {}
-for a in *arg
- if match = a\match '^%-%-(.*)'
- k = match
- arguments[k] = true
- elseif k
- arguments[k] = a
- k = nil
- else
- table.insert arguments, a
-
-Logger.init arguments.log
-
-copilot = Copilot arguments[#arguments]
-
-love.update = (dt) ->
- copilot\update dt
-
-love.draw = ->
- out.draw_all!
-
-{
- :out
- :key
-}