summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2022-10-17 08:14:18 -0400
committerDavid Thompson <dthompson2@worcester.edu>2022-10-17 08:14:18 -0400
commit5edce04c698cd92149004ead1cad77c481c682e8 (patch)
tree526b428e10e714e649d4f9fd83d73cc0e81512d5 /examples
parentb4b1dbaaec28331572503828d1b30ec0eea79619 (diff)
Rename (chickadee graphics font) to (chickadee graphics text).
Diffstat (limited to 'examples')
-rw-r--r--examples/9-patch.scm2
-rw-r--r--examples/audio.scm2
-rw-r--r--examples/game-controller.scm2
-rw-r--r--examples/grid.scm4
-rw-r--r--examples/model.scm2
-rw-r--r--examples/particles.scm2
-rw-r--r--examples/path.scm2
-rw-r--r--examples/quadtree.scm2
-rw-r--r--examples/sprite-batch.scm2
-rw-r--r--examples/text.scm81
-rw-r--r--examples/tile-map.scm2
11 files changed, 88 insertions, 15 deletions
diff --git a/examples/9-patch.scm b/examples/9-patch.scm
index feb02b0..debc69d 100644
--- a/examples/9-patch.scm
+++ b/examples/9-patch.scm
@@ -1,8 +1,8 @@
(use-modules (chickadee)
(chickadee math rect)
(chickadee math vector)
- (chickadee graphics font)
(chickadee graphics 9-patch)
+ (chickadee graphics text)
(chickadee graphics texture))
(define image #f)
diff --git a/examples/audio.scm b/examples/audio.scm
index 4ea697f..72826b9 100644
--- a/examples/audio.scm
+++ b/examples/audio.scm
@@ -1,7 +1,7 @@
(use-modules (chickadee)
(chickadee audio)
(chickadee math vector)
- (chickadee graphics font)
+ (chickadee graphics text)
(ice-9 match))
(define effect #f)
diff --git a/examples/game-controller.scm b/examples/game-controller.scm
index f166939..d8a6002 100644
--- a/examples/game-controller.scm
+++ b/examples/game-controller.scm
@@ -1,8 +1,8 @@
(use-modules (chickadee)
(chickadee math vector)
(chickadee graphics color)
- (chickadee graphics font)
(chickadee graphics sprite)
+ (chickadee graphics text)
(chickadee graphics texture)
(ice-9 match))
diff --git a/examples/grid.scm b/examples/grid.scm
index c83dac7..4a5dbd2 100644
--- a/examples/grid.scm
+++ b/examples/grid.scm
@@ -3,9 +3,9 @@
(chickadee math vector)
(chickadee math rect)
(chickadee graphics color)
- (chickadee graphics font)
(chickadee graphics path)
- (chickadee graphics sprite))
+ (chickadee graphics sprite)
+ (chickadee graphics text))
(define grid (make-grid))
(define item-color (make-color 0.7 0.0 0.0 0.7))
diff --git a/examples/model.scm b/examples/model.scm
index 26067b6..4fa42c7 100644
--- a/examples/model.scm
+++ b/examples/model.scm
@@ -4,7 +4,7 @@
(chickadee math vector)
(chickadee graphics engine)
(chickadee graphics model)
- (chickadee graphics font)
+ (chickadee graphics text)
(ice-9 format))
(define projection (perspective-projection (/ pi 3) (/ 4.0 3.0) 0.1 500.0))
diff --git a/examples/particles.scm b/examples/particles.scm
index f7d096e..cab390b 100644
--- a/examples/particles.scm
+++ b/examples/particles.scm
@@ -2,9 +2,9 @@
(chickadee math rect)
(chickadee math vector)
(chickadee graphics color)
- (chickadee graphics font)
(chickadee graphics particles)
(chickadee graphics sprite)
+ (chickadee graphics text)
(chickadee graphics texture)
(chickadee scripting)
(ice-9 format))
diff --git a/examples/path.scm b/examples/path.scm
index 202a859..44cabdb 100644
--- a/examples/path.scm
+++ b/examples/path.scm
@@ -1,7 +1,7 @@
(use-modules (chickadee)
(chickadee graphics color)
- (chickadee graphics font)
(chickadee graphics path)
+ (chickadee graphics text)
(chickadee math)
(chickadee math vector)
(chickadee scripting))
diff --git a/examples/quadtree.scm b/examples/quadtree.scm
index 31b8138..d95c00f 100644
--- a/examples/quadtree.scm
+++ b/examples/quadtree.scm
@@ -5,10 +5,10 @@
(chickadee math rect)
(chickadee math vector)
(chickadee graphics color)
- (chickadee graphics font)
(chickadee graphics path)
(chickadee graphics sprite)
(chickadee graphics texture)
+ (chickadee graphics text)
(chickadee scripting)
(ice-9 format)
(ice-9 match)
diff --git a/examples/sprite-batch.scm b/examples/sprite-batch.scm
index b63179f..e62d1e4 100644
--- a/examples/sprite-batch.scm
+++ b/examples/sprite-batch.scm
@@ -3,8 +3,8 @@
(chickadee math rect)
(chickadee math vector)
(chickadee graphics color)
- (chickadee graphics font)
(chickadee graphics sprite)
+ (chickadee graphics text)
(chickadee graphics texture)
(chickadee scripting)
(ice-9 format)
diff --git a/examples/text.scm b/examples/text.scm
index 3d2b3b5..d4d6489 100644
--- a/examples/text.scm
+++ b/examples/text.scm
@@ -1,9 +1,82 @@
(use-modules (chickadee)
+ (chickadee graphics text)
(chickadee math vector)
- (chickadee graphics font))
+ (chickadee scripting))
+
+(define start-time 0.0)
+(define avg-frame-time 16.0)
+(define stats-text "")
+(define stats-position (vec2 4.0 704.0))
+(define position (vec2 140.0 0.0))
+(define text
+ "This is the \"Are you tired of *this*?\" part of the infomercial. Read the next few paragraphs
+and picture me, in black and white, struggling to hold a large stack of boxes, all labeled
+\"software.\" I continue struggling to balance the boxes as you read. When you've reached the last
+paragraph of the section, I fall over, the boxes land on top of me and all over the floor, I'm
+covered in spaghetti, and in an exasperated voice I shout \"There's gotta be a better way!\"
+
+When setting up a new computer for software development, I want to go from `git clone` to `make` in
+as little time as possible (adjust that for your VCS and build system of choice.) In the old days,
+this meant manually installing the dependencies through the distro package manager. If things are
+organized, the project README will have a list of what is needed and it's not so bad. If things are
+less organized, it's a cycle of installing packages and running `./configure` or whatever until it
+succeeds. Hopefully none of the dependencies are too new to be found in the distro. And when
+working on multiple projects, hopefully there's no conflicts between the dependencies required for
+each of them, because your development environment is the entire system and there's no way to
+isolate different projects from each other.
+
+Of course, different programming languages provide their own sets of tools for managing multiple
+projects. Python has virtualenv, Ruby has rvm and bundler, Node has nvm and npm, etc. But their
+domain is restricted to only the dependencies for that language and their runtimes. A system
+package manager is needed to bootstrap their use.
+
+Nowadays it's \"just use Docker.\" Docker's take is that all this package management stuff is just
+too complicated. Instead, just create a disk image per project that encapsulates this hodgepodge of
+package managers and bespoke, artisinal, small-batch builds that gets run in isolation via Linux
+namespace magic. It works, of course, but I think Dockerfiles are clunky and the rather extreme
+level of isolation is usually unnecessary and makes things overly complicated for projects that need
+to interact with, say, the windowing system of the host computer. A lot of people are happy with
+Docker, though. Maybe you are, too. That's fine!
+
+What I really want to say is \"Computer, provision a development environment containing Guile 3,
+SDL2, make, and texinfo!\" and have Majel Barrett-Roddenberry tell me that all of those things have
+been made available to me on my host system. No container, no virtual machine. It shouldn't matter
+if I have Guile 2 installed system-wide, Guile 3 should still be what's used in the context of the
+project. This is how Guix works and it's very good and cool and I'm going to tell you all about how
+I use it."
+ ;; "The quick brown fox jumps over the lazy dog.\nFive hexing wizard bots jump quickly."
+ )
+
+(define (stats-message)
+ (format #f "fps: ~1,2f"
+ (/ 1.0 avg-frame-time)))
+
+(define (load)
+ (script
+ (forever
+ (sleep 60)
+ (set! stats-text (stats-message)))))
(define (draw alpha)
- (draw-text "The quick brown fox jumps over the lazy dog.\nFive hexing wizard bots jump quickly."
- (vec2 140.0 240.0)))
+ (draw-text text position)
+ (draw-text stats-text stats-position)
+ (let ((current-time (elapsed-time)))
+ (set! avg-frame-time
+ (+ (* (- current-time start-time) 0.1)
+ (* avg-frame-time 0.9)))
+ (set! start-time current-time)))
+
+(define (update dt)
+ (update-agenda 1))
+
+(define (key-press key modifiers repeat?)
+ (when (eq? key 'q)
+ (abort-game)))
-(run-game #:draw draw)
+(run-game #:draw draw
+ #:key-press key-press
+ #:load load
+ #:update update
+ #:window-title "text rendering"
+ #:window-width 1280
+ #:window-height 720)
diff --git a/examples/tile-map.scm b/examples/tile-map.scm
index ae1342b..7aea4ca 100644
--- a/examples/tile-map.scm
+++ b/examples/tile-map.scm
@@ -2,7 +2,7 @@
(chickadee math vector)
(chickadee math rect)
(chickadee graphics color)
- (chickadee graphics font)
+ (chickadee graphics text)
(chickadee graphics tile-map)
(ice-9 format)
(ice-9 match)