From 25c5eac5e6ca1035db1eddd7bea9ac78531da57e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 28 Dec 2023 11:23:49 -0500 Subject: Delete manuals! Good riddance! These are hosted on files.dthompson.us now! --- manuals/chickadee/Getting-Started.html | 177 --------------------------------- 1 file changed, 177 deletions(-) delete mode 100644 manuals/chickadee/Getting-Started.html (limited to 'manuals/chickadee/Getting-Started.html') diff --git a/manuals/chickadee/Getting-Started.html b/manuals/chickadee/Getting-Started.html deleted file mode 100644 index e7d695d..0000000 --- a/manuals/chickadee/Getting-Started.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - -Getting Started (The Chickadee Game Toolkit) - - - - - - - - - - - - - - - - - - - -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
-
-

2 Getting Started

- -

One of the simplest programs we can make with Chickadee is rendering -the text “Hello, world” on screen. Here’s what that looks like: -

-
-
(define (draw alpha)
-  (draw-text "Hello, world!" (vec2 64.0 240.0)))
-
- -

The draw procedure is called frequently to draw the game scene. -For the sake of simplicity, we will ignore the alpha variable -in this tutorial. -

-

To run this program, we’ll use the chickadee play command: -

-
-
chickadee play hello.scm
-
- -

This is a good start, but it’s boring. Let’s make the text move! -

-
-
(define position (vec2 0.0 240.0))
-
-(define (draw alpha)
-  (draw-text "Hello, world!" position))
-
-(define (update dt)
-  (set-vec2-x! position (+ (vec2-x position) (* 100.0 dt))))
-
- -

The vec2 type is used to store 2D coordinates -(see Vectors.) A variable named position contains the -position where the text should be rendered. A new hook called -update has been added to handle the animation. This hook is -called frequently to update the state of the game. The variable -dt (short for “delta-time”) contains the amount of time that -has passed since the last update, in seconds. Putting it all -together, this update procedure is incrementing the x coordinate of -the position by 100 pixels per second. -

-

This is neat, but after a few seconds the text moves off the screen -completely, never to be seen again. It would be better if the text -bounced back and forth against the sides of the window. -

-
-
(define position (vec2 0.0 240.0))
-
-(define (draw alpha)
-  (draw-text "Hello, world!" position))
-
-(define (update dt)
-  (update-agenda dt))
-
-(define (update-x x)
-  (set-vec2-x! position x))
-
-(let ((start 0.0)
-      (end 536.0)
-      (duration 4.0))
-  (script
-   (while #t
-    (tween duration start end update-x)
-    (tween duration end start update-x))))
-
- -

This final example uses Chickadee’s scripting features -(see Scripting) to bounce the text between the edges of the window -indefinitely using the handy tween procedure. The only thing -the update procedure needs to do now is advance the clock of -the “agenda” (the thing that runs scripts.) The script takes care -of the rest. -

-

This quick tutorial has hopefully given you a taste of what you can do -with Chickadee. The rest of this manual gets into all of the details -that were glossed over, and much more. Try rendering a sprite, -playing a sound effect, or handling keyboard input. But most -importantly: Have fun! -

-
-
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- - - - - -- cgit v1.2.3