diff options
author | David Thompson <dthompson@vistahigherlearning.com> | 2020-12-16 09:55:44 -0500 |
---|---|---|
committer | David Thompson <dthompson@vistahigherlearning.com> | 2020-12-16 09:55:44 -0500 |
commit | 656b2b626f7acf75c27466d4ec7f6e34e8b1847a (patch) | |
tree | 8c1fcd4070bb353667f26c239a4bd2cc0b24adc6 /examples | |
parent | ec402eeec40d903c45cdc981a268fba6f0c070cb (diff) |
Update examples so they work with latest code.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/shmup/shmup.scm | 35 | ||||
-rw-r--r-- | examples/tetra/tetra.scm | 46 |
2 files changed, 43 insertions, 38 deletions
diff --git a/examples/shmup/shmup.scm b/examples/shmup/shmup.scm index b15ef7c..d1f9abc 100644 --- a/examples/shmup/shmup.scm +++ b/examples/shmup/shmup.scm @@ -3,9 +3,9 @@ (chickadee math rect) (chickadee math vector) (chickadee graphics color) - (chickadee graphics shapes) - (chickadee graphics texture) + (chickadee graphics path) (chickadee graphics sprite) + (chickadee graphics texture) (chickadee scripting) (ice-9 match) (oop goops) @@ -295,8 +295,9 @@ (next-method) (when (and *render-hitboxes?* (visible? actor)) (for-each (lambda (hitbox) - (draw-filled-rect (rect hitbox) %hitbox-color - #:matrix (world-matrix actor))) + ;; (draw-filled-rect (rect hitbox) %hitbox-color + ;; #:matrix (world-matrix actor)) + #t) (hitboxes actor)))) (define-method (collide (bullets <bullet-field>) (actor <actor>) proc) @@ -477,11 +478,12 @@ #:frames #(23 24 25) #:frame-duration 50))) #:default-animation 'idle) - (make <filled-rect> - #:name 'shield - #:region (make-rect -30.0 -35.0 60.0 60.0) - #:color (make-color 1.0 0.0 1.0 0.5) - #:visible? #f))) + ;; (make <filled-rect> + ;; #:name 'shield + ;; #:region (make-rect -30.0 -35.0 60.0 60.0) + ;; #:color (make-color 1.0 0.0 1.0 0.5) + ;; #:visible? #f) + )) (define-method (emit-bullet (player <player>) ox oy theta speed) (let ((p (position player))) @@ -553,11 +555,13 @@ (define-method (begin-guarding (player <player>)) (set! (guarding? player) #t) - (show (& player shield))) + ;;(show (& player shield)) + ) (define-method (end-guarding (player <player>)) (set! (guarding? player) #f) - (hide (& player shield))) + ;;(hide (& player shield)) + ) ;;; @@ -587,10 +591,11 @@ (set-rect-height! f h))) (define-method (render (meter <meter>) alpha) - (draw-filled-rect (background-rect meter) (background-color meter) - #:matrix (world-matrix meter)) - (draw-filled-rect (fill-rect meter) (fill-color meter) - #:matrix (world-matrix meter))) + ;; (draw-filled-rect (background-rect meter) (background-color meter) + ;; #:matrix (world-matrix meter)) + ;; (draw-filled-rect (fill-rect meter) (fill-color meter) + ;; #:matrix (world-matrix meter)) + #t) ;;; diff --git a/examples/tetra/tetra.scm b/examples/tetra/tetra.scm index 5723b31..f8a10d3 100644 --- a/examples/tetra/tetra.scm +++ b/examples/tetra/tetra.scm @@ -27,6 +27,7 @@ (chickadee graphics color) (chickadee graphics font) (chickadee graphics particles) + (chickadee graphics path) (chickadee graphics texture) (chickadee graphics sprite) (chickadee scripting) @@ -329,10 +330,11 @@ area next to the board." (define-method (on-boot (board <board>)) (set! (batch board) (make-sprite-batch #f)) (attach-to board - (make <filled-rect> + (make <path> #:name 'background - #:region (make-rect 0.0 0.0 320.0 640.0) - #:color tango-aluminium-6) + #:painter (with-style ((fill-color tango-aluminium-6)) + (fill + (rectangle (vec2 0.0 0.0) 320.0 640.0)))) (make <sprite-batch> #:name 'batch #:batch (batch board)) @@ -515,17 +517,13 @@ area next to the board." (/ container-width 2.0)) (/ (- window-height container-height) 2.0))))) (attach-to container - (make <filled-rect> + (make <path> #:name 'background - #:region (make-rect 0.0 0.0 container-width container-height) - #:color tango-aluminium-3) - (make <filled-rect> - #:name 'background - #:region (make-rect border - border - (- container-width (* border 2.0)) - (- container-height (* border 2.0))) - #:color tango-aluminium-6) + #:painter (with-style ((fill-color tango-aluminium-6) + (stroke-color tango-aluminium-3) + (stroke-width border)) + (fill-and-stroke + (rectangle (vec2 0.0 0.0) container-width container-height)))) (make <label> #:name 'message #:text message @@ -573,9 +571,10 @@ area next to the board." (define-method (on-boot (tetra <tetra>)) (set! (board tetra) (make <board>)) (attach-to tetra - (make <filled-rect> - #:region (make-rect 0.0 0.0 window-width window-height) - #:color tango-aluminium-5) + (make <path> + #:painter (with-style ((fill-color tango-aluminium-5)) + (fill + (rectangle (vec2 0.0 0.0) window-width window-height)))) (let ((text "NEXT")) (make <label> #:name 'next-label @@ -583,14 +582,15 @@ area next to the board." #:font click-font #:position (vec2 (centered-text text) 630.0) #:scale (vec2 2.0 2.0))) - (make <filled-rect> + (make <path> #:name 'next-background - #:color tango-aluminium-6 - #:region (let* ((w (* tile-width 5.0)) - (h (* tile-height 3.0)) - (x (centered w)) - (y (- 630.0 h 16.0))) - (make-rect x y w h))) + #:painter (with-style ((fill-color tango-aluminium-6)) + (fill + (let* ((w (* tile-width 5.0)) + (h (* tile-height 3.0)) + (x (centered w)) + (y (- 630.0 h 16.0))) + (rectangle (vec2 x y) w h))))) (let ((text "HI CHRIS")) (make <label> #:name 'score-label |