From 70b48cc32c23b8aaa6fbdd3f5c459eb924c5cbd4 Mon Sep 17 00:00:00 2001 From: s-ol Date: Sat, 13 Nov 2021 16:34:13 +0100 Subject: update examples --- .gitignore | 1 + README.md | 4 ++-- alv/copilot/love/main.lua | 1 + bin/alv-love | 3 ++- examples/hello.alv | 2 ++ examples/love.alv | 7 +++++++ hello.alv | 2 -- 7 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 examples/hello.alv create mode 100644 examples/love.alv delete mode 100644 hello.alv 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 + $ 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 + $ 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/examples/hello.alv b/examples/hello.alv new file mode 100644 index 0000000..5376cb0 --- /dev/null +++ b/examples/hello.alv @@ -0,0 +1,2 @@ +([1]import* time) +([2]print ([3]every 0.5 "hello world!")) 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)))) diff --git a/hello.alv b/hello.alv deleted file mode 100644 index 5376cb0..0000000 --- a/hello.alv +++ /dev/null @@ -1,2 +0,0 @@ -([1]import* time) -([2]print ([3]every 0.5 "hello world!")) -- cgit v1.2.3