aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-11-13 15:34:13 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-02 14:24:49 +0000
commit70b48cc32c23b8aaa6fbdd3f5c459eb924c5cbd4 (patch)
treeffe9bd3a9da69ac03830fc6f561eb4ae43ab22e3
parentFix love event input streams (diff)
downloadalive-70b48cc32c23b8aaa6fbdd3f5c459eb924c5cbd4.tar.gz
alive-70b48cc32c23b8aaa6fbdd3f5c459eb924c5cbd4.zip
update examples
-rw-r--r--.gitignore1
-rw-r--r--README.md4
-rw-r--r--alv/copilot/love/main.lua1
-rwxr-xr-xbin/alv-love3
-rw-r--r--examples/hello.alv (renamed from hello.alv)0
-rw-r--r--examples/love.alv7
6 files changed, 13 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 8d17864..e4d64ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
luarocks.lock
/*.alv
!/hello.alv
+!/examples/*
diff --git a/README.md b/README.md
index a681e39..e92a690 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ The latest documentation is publicly available online at [alv.s-ol.nu][docs].
## starting the copilot
- $ bin/alv <session.alv>
+ $ bin/alv examples/hello.alv
For more information see the [getting started guide][guide].
@@ -44,7 +44,7 @@ For more information see the [getting started guide][guide].
To use the 'love' module for relatime 2d graphics, the copilot needs to be
started using [love2d][love] (0.11+):
- $ love bin/alv-love <session.alv>
+ $ bin/alv-love examples/love2d.alv
## running the tests
diff --git a/alv/copilot/love/main.lua b/alv/copilot/love/main.lua
index 7b95a26..354732d 100644
--- a/alv/copilot/love/main.lua
+++ b/alv/copilot/love/main.lua
@@ -1,3 +1,4 @@
+package.path = "./?/init.lua;" .. package.path
require('moonscript')
local Copilot = require('alv.copilot.love').LoveCopilot
Copilot(arg):run()
diff --git a/bin/alv-love b/bin/alv-love
index 10c44ab..4eb7cb7 100755
--- a/bin/alv-love
+++ b/bin/alv-love
@@ -2,4 +2,5 @@
LOVE=$(which love11 love 2>/dev/null | head -n 1)
BASE=$(dirname "$0")
echo "base '$BASE'"
-exec "$LOVE" "$BASE/../alv/copilot/love" "$@"
+cd "$BASE/.."
+exec "$LOVE" "alv/copilot/love" "$@"
diff --git a/hello.alv b/examples/hello.alv
index 5376cb0..5376cb0 100644
--- a/hello.alv
+++ b/examples/hello.alv
diff --git a/examples/love.alv b/examples/love.alv
new file mode 100644
index 0000000..7158e60
--- /dev/null
+++ b/examples/love.alv
@@ -0,0 +1,7 @@
+([1]import* love math time)
+([2]draw ([3]->>
+ ([8]rectangle 'fill' 100 100)
+ ([14]color 1 0 0)
+ ([15]scale ([16]switch ([17]mouse-down? 1) 0.5 1))
+ ([5]rotate ([9]ramp 2 tau))
+ ([4]translate ([10]mouse-pos))))