diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-12-30 19:32:19 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2024-07-24 21:54:32 -0400 |
commit | 76dc3f0af36775d2fdaab61134dd0f875ee48292 (patch) | |
tree | 33fe349038005f7e5f733856895903257a448b54 /examples/9-patch.scm | |
parent | 41e7e7152a66f40f3a23439fb0ea4b2b03acbf1c (diff) |
WIP graphics engine rewrite.
Diffstat (limited to 'examples/9-patch.scm')
-rw-r--r-- | examples/9-patch.scm | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/9-patch.scm b/examples/9-patch.scm index 518ef89..1fa5b85 100644 --- a/examples/9-patch.scm +++ b/examples/9-patch.scm @@ -2,24 +2,25 @@ (chickadee math rect) (chickadee math vector) (chickadee graphics 9-patch) + (chickadee graphics sprite) (chickadee graphics text) (chickadee graphics texture)) -(define image #f) -(define region1 #f) -(define region2 #f) +(define texture #f) +(define sprite1 #f) +(define sprite2 #f) (define area1 (make-rect 192.0 192.0 256.0 96.0)) (define area2 (make-rect 192.0 50.0 256.0 96.0)) (define text-position (vec2 204.0 266.0)) (define (load) - (set! image (load-image "images/dialog-box.png")) - (set! region1 (make-texture-region image (make-rect 0.0 0.0 78.0 39.0))) - (set! region2 (make-texture-region image (make-rect 78.0 0.0 41.0 18.0)))) + (set! texture (texture-view (load-image "images/dialog-box.png"))) + (set! sprite1 (make-sprite texture (make-rect 0.0 0.0 78.0 39.0))) + (set! sprite2 (make-sprite texture (make-rect 78.0 0.0 41.0 18.0)))) (define (draw alpha) - (draw-9-patch region1 area1 #:margin 7.0) - (draw-9-patch region2 area2 #:margin 4.0) + (draw-9-patch sprite1 area1 #:margin 7.0) + (draw-9-patch sprite2 area2 #:margin 4.0) (draw-text "This is the 9-patch test." text-position)) (run-game #:load load #:draw draw) |