aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-07-22 11:58:16 -0500
committerColin Okay <colin@cicadas.surf>2022-07-22 11:58:16 -0500
commit00841605110612f6e7f3bbfc054ceff980bf25be (patch)
tree1f16b86d5c555eea22e60cb2d36f88682bd9023b /examples
parent6d9b8b48423dba99ecdba004f260c30e6717b6a6 (diff)
[version] [refactor] [redesign] removed containers
Diffstat (limited to 'examples')
-rw-r--r--examples/01-click-and-drag-image.lisp6
-rw-r--r--examples/02-image-transforms-and-events.lisp4
-rw-r--r--examples/02-moving-bitmp.lisp4
-rw-r--r--examples/03-font-render.lisp4
-rw-r--r--examples/04-a-button.lisp4
-rw-r--r--examples/05-frameset-animation.lisp2
-rw-r--r--examples/06-sprite.lisp2
-rw-r--r--examples/07-renderarea.lisp15
-rw-r--r--examples/08-pong.lisp8
-rw-r--r--examples/09-ghoulspree.lisp8
-rw-r--r--examples/10-canvas-sneks.lisp2
-rw-r--r--examples/11-canvas-geometry.lisp2
-rw-r--r--examples/12-canvas-drawing-language.lisp2
13 files changed, 28 insertions, 35 deletions
diff --git a/examples/01-click-and-drag-image.lisp b/examples/01-click-and-drag-image.lisp
index 8793fae..e895d24 100644
--- a/examples/01-click-and-drag-image.lisp
+++ b/examples/01-click-and-drag-image.lisp
@@ -11,14 +11,14 @@
(ww::defhandler dragging-unit
(ww::on-mousemotion (app x y)
(let ((unit
- (first (ww:container-units app))))
+ (first (ww::application-scene app))))
(setf (ww:x unit) x
(ww:y unit) y))))
(ww:defhandler start-drag
(ww:on-mousedown (target)
(ww::add-handler
- (ww::unit-container target)
+ ww::*application*
#'dragging-unit)))
(ww:defhandler stop-drag
@@ -33,7 +33,7 @@
(describe (ww::model-matrix bm))
(describe bm)
(describe app)
- (ww::add-unit app bm)
+ (ww::add-unit bm)
(ww::add-handler bm #'start-drag)
(ww::add-handler app #'stop-drag)
(format t "CLICK AND DRAG THE GHOUL~%")
diff --git a/examples/02-image-transforms-and-events.lisp b/examples/02-image-transforms-and-events.lisp
index bb348a1..edc9000 100644
--- a/examples/02-image-transforms-and-events.lisp
+++ b/examples/02-image-transforms-and-events.lisp
@@ -125,8 +125,8 @@
(ww::add-handler bm2 #'look-away)
(ww::add-handler bm2 #'wheelie)
- (ww::add-unit app bm)
- (ww::add-unit app bm2)))
+ (ww::add-unit bm)
+ (ww::add-unit bm2)))
(defun start ()
diff --git a/examples/02-moving-bitmp.lisp b/examples/02-moving-bitmp.lisp
index bb348a1..edc9000 100644
--- a/examples/02-moving-bitmp.lisp
+++ b/examples/02-moving-bitmp.lisp
@@ -125,8 +125,8 @@
(ww::add-handler bm2 #'look-away)
(ww::add-handler bm2 #'wheelie)
- (ww::add-unit app bm)
- (ww::add-unit app bm2)))
+ (ww::add-unit bm)
+ (ww::add-unit bm2)))
(defun start ()
diff --git a/examples/03-font-render.lisp b/examples/03-font-render.lisp
index c8188df..de3c487 100644
--- a/examples/03-font-render.lisp
+++ b/examples/03-font-render.lisp
@@ -68,12 +68,12 @@
(ww::add-handler hello #'change-text-color)
(ww::add-handler hello #'twirl-on-click)
(ww::refocus-on hello)
- (ww::add-unit app hello)
+ (ww::add-unit hello)
(ww::scale-by instructions 2.0)
(setf
(ww::x instructions) (* 0.5 (- 800 (ww::width instructions))))
- (ww::add-unit app instructions)))
+ (ww::add-unit instructions)))
(defun start ()
diff --git a/examples/04-a-button.lisp b/examples/04-a-button.lisp
index b96364e..82f5a2c 100644
--- a/examples/04-a-button.lisp
+++ b/examples/04-a-button.lisp
@@ -26,8 +26,8 @@
(ww::scale-by b 4.0)
(ww::scale-by b2 3)
;; add to scene
- (ww::add-unit app b2)
- (ww::add-unit app b)))
+ (ww::add-unit b2)
+ (ww::add-unit b)))
(defun start ()
(ww::start (make-instance
diff --git a/examples/05-frameset-animation.lisp b/examples/05-frameset-animation.lisp
index 12207f3..a359f77 100644
--- a/examples/05-frameset-animation.lisp
+++ b/examples/05-frameset-animation.lisp
@@ -27,7 +27,7 @@
(ww::add-handler fs #'toggle-on-click)
- (ww::add-unit app fs)))
+ (ww::add-unit fs)))
(defun start ()
diff --git a/examples/06-sprite.lisp b/examples/06-sprite.lisp
index abb5043..256ee95 100644
--- a/examples/06-sprite.lisp
+++ b/examples/06-sprite.lisp
@@ -115,7 +115,7 @@
(ww::add-handler dude #'stand)
(ww::add-handler dude #'speed-control)
(ww::refocus-on dude)
- (ww::add-unit app dude)))
+ (ww::add-unit dude)))
(defun start ()
(ww::start (make-instance
diff --git a/examples/07-renderarea.lisp b/examples/07-renderarea.lisp
index 95a6e9d..5fc6f0e 100644
--- a/examples/07-renderarea.lisp
+++ b/examples/07-renderarea.lisp
@@ -33,27 +33,20 @@
(let ((cube
(make-instance
'ww::image
- :texture (ww::get-asset "GelatinousCube.png")))
- (cube-container
- (make-instance
- 'ww::container
- :bottom 200 :top 400
- :left 200 :right 600)))
+ :texture (ww::get-asset "GelatinousCube.png"))))
(setf (cube app) cube)
(ww::add-handler app #'move-cube)
(ww::add-handler cube #'clicked)
-
(setf (ww::x cube) 400
(ww::y cube) 300)
(ww::scale-by cube 2.0)
- (ww::add-unit cube-container cube)
- (ww::add-unit app cube-container)
-
- (describe cube-container)))
+ (ww::add-unit cube)
+ (setf (ww::unit-region cube)
+ (make-instance 'ww::region :bottom 200 :top 400 :left 200 :right 600))))
(defun start ()
diff --git a/examples/08-pong.lisp b/examples/08-pong.lisp
index f40e66d..574eacd 100644
--- a/examples/08-pong.lisp
+++ b/examples/08-pong.lisp
@@ -163,9 +163,9 @@ on which boundary VAL is outside of."
(ball app) ball
(game-over app) game-over)
- (ww::add-unit app ball)
- (ww::add-unit app paddle)
- (ww::add-unit app game-over)
+ (ww::add-unit ball)
+ (ww::add-unit paddle)
+ (ww::add-unit game-over)
(ww::add-handler app #'pong-mousemove)
(ww::add-handler app #'pong-perframe))))
@@ -183,7 +183,7 @@ on which boundary VAL is outside of."
:scale-x 3.0
:scale-y 3.0)))
(setf (intro-text app) intro-text)
- (ww:add-unit app intro-text))
+ (ww:add-unit intro-text))
(ww:add-handler app #'press-to-start))
(defun start ()
diff --git a/examples/09-ghoulspree.lisp b/examples/09-ghoulspree.lisp
index cf18e31..b3c0106 100644
--- a/examples/09-ghoulspree.lisp
+++ b/examples/09-ghoulspree.lisp
@@ -80,7 +80,7 @@ on which boundary VAL is outside of."
;; first handle collisions
(when (collision-on-p app)
(with-pairs
- (g1 g2) (ww:container-units app)
+ (g1 g2) (ww::application-scene app)
(when (ww:units-intersect-p g1 g2)
(handle-collision g1 g2 1.0)
;; need a "bounce"
@@ -93,7 +93,7 @@ on which boundary VAL is outside of."
(gravity-on-p app))
(accelleration
(/ 9.8 (ww:fps app))))
- (loop for ghoul in (ww:container-units app)
+ (loop for ghoul in (ww::application-scene app)
do (advance-pos ghoul)
when gravity
do (apply-gravity-to ghoul accelleration)
@@ -111,9 +111,9 @@ on which boundary VAL is outside of."
(loop repeat (ghouls-per-click app)
for rx = (random 800); (+ x (* (random-sign) (random-between 30 60)))
for ry = (random 600); (+ y (* (random-sign) (random-between 30 60)))
- do (ww:add-unit app (make-ghoul rx ry)))
+ do (ww:add-unit (make-ghoul rx ry)))
(format t "~a ghouls on screen~%"
- (length (ww:container-units app )))))
+ (length (ww::application-scene app )))))
(ww:defhandler toggle-collision
diff --git a/examples/10-canvas-sneks.lisp b/examples/10-canvas-sneks.lisp
index a69b429..ef5d1d5 100644
--- a/examples/10-canvas-sneks.lisp
+++ b/examples/10-canvas-sneks.lisp
@@ -111,7 +111,7 @@ sneks. Adds the canvas to the app, and sets up the perframe handler."
(loop repeat (population app) collect (random-snek 100 100)))
(setf (ww:width (snek-pit app)) (ww::application-width app)
(ww:height (snek-pit app)) (ww::application-width app))
- (ww::add-unit app (snek-pit app))
+ (ww::add-unit (snek-pit app))
(ww:add-handler app #'sneks-a-go-go))
(defun start (&key (side 800) (population 50))
diff --git a/examples/11-canvas-geometry.lisp b/examples/11-canvas-geometry.lisp
index c144c10..9f781a8 100644
--- a/examples/11-canvas-geometry.lisp
+++ b/examples/11-canvas-geometry.lisp
@@ -73,7 +73,7 @@
(ww:height canvas) (ww::application-height app))
;; add it to the display tree
- (ww:add-unit app canvas)
+ (ww:add-unit canvas)
;; handlers
(ww::add-handler canvas #'clear-and-draw)
diff --git a/examples/12-canvas-drawing-language.lisp b/examples/12-canvas-drawing-language.lisp
index 0713d90..a727f7b 100644
--- a/examples/12-canvas-drawing-language.lisp
+++ b/examples/12-canvas-drawing-language.lisp
@@ -104,7 +104,7 @@
(ww:height canvas) (ww::application-height app))
;; add it to the display tree
- (ww:add-unit app canvas)
+ (ww:add-unit canvas)
;; handlers
(ww:add-handler canvas #'clear-and-draw)