diff --git a/examples/tilt-sensor/lisp/main.lisp b/examples/tilt-sensor/lisp/main.lisp index 62b16f2..bd95040 100644 --- a/examples/tilt-sensor/lisp/main.lisp +++ b/examples/tilt-sensor/lisp/main.lisp @@ -5,6 +5,8 @@ (defvar *x*) ; ball x (defvar *y*) ; ball y +(defvar *max-x* (* (1- *width*) +w+)) + (defun move (x-rotation y-rotation) ; called from QML (labels ((add (x) (truncate (signum x))) @@ -19,6 +21,7 @@ (dy (min (* 0.2 x-rotation) (1- +w+))) (add-x (add dx)) (add-y (add dy))) + (setf *x* (min *x* *max-x*)) ; don't lose ball (initial x) (if (aref *maze* (+ add-x (to-pos *x*)) (to-pos *y*)) diff --git a/examples/tilt-sensor/lisp/maze.lisp b/examples/tilt-sensor/lisp/maze.lisp index 28c07a8..8bf281b 100644 --- a/examples/tilt-sensor/lisp/maze.lisp +++ b/examples/tilt-sensor/lisp/maze.lisp @@ -51,7 +51,7 @@ (set-visible x y (aref *maze* x y))))) (defun new-maze () - (setf *maze* (make-array (list (1+ *width*) (1+ *height*)) + (setf *maze* (make-array (list *width* *height*) :initial-element t)) (display-maze) (qlater 'generate-maze)) diff --git a/readme-qml-live-preview-and-slime.md b/readme-qml-live-preview-and-slime.md index 2e48735..8f6f4a5 100644 --- a/readme-qml-live-preview-and-slime.md +++ b/readme-qml-live-preview-and-slime.md @@ -4,9 +4,9 @@ development, the simple `-auto` option of `lqml run.lisp` may be more appropriate, because it allows for re-initialization (calling Lisp code) after reloading QML.* -*The above method also works on mobile, please see example `swank-server`. It -doesn't depend on Swank, and should therefore also be stable (it uses a local -trivial web server).* +*The above method also works on mobile, please see example +`advanced-qml-auto-realod`. It doesn't depend on Swank, and should therefore +also be stable (it uses a local trivial web server).* *You may even run both desktop and (one or more) mobile device auto reloads simultaneously (`swank-server` example only), because they all watch/load the