From 03072ef67af0623758a660e2cd3fb5e153133efa Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 24 May 2023 08:09:03 -0400 Subject: Update chickadee manual. --- manuals/chickadee/Getting-Started.html | 88 +++++++++++++++++----------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'manuals/chickadee/Getting-Started.html') diff --git a/manuals/chickadee/Getting-Started.html b/manuals/chickadee/Getting-Started.html index 7508ebe..e7d695d 100644 --- a/manuals/chickadee/Getting-Started.html +++ b/manuals/chickadee/Getting-Started.html @@ -1,6 +1,6 @@ - - + --> + - + Getting Started (The Chickadee Game Toolkit) - - - - - - - - - - - + + + + + + + + + + + - + @@ -84,15 +84,15 @@ ul.no-bullet {list-style: none}

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)))
+
+
(define (draw alpha)
+  (draw-text "Hello, world!" (vec2 64.0 240.0)))
 

The draw procedure is called frequently to draw the game scene. @@ -107,14 +107,14 @@ in this tutorial.

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

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

The vec2 type is used to store 2D coordinates @@ -131,25 +131,25 @@ the position by 100 pixels per second. 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 position (vec2 0.0 240.0))
 
-(define (draw alpha)
-  (draw-text "Hello, world!" position))
+(define (draw alpha)
+  (draw-text "Hello, world!" position))
 
-(define (update dt)
-  (update-agenda dt))
+(define (update dt)
+  (update-agenda dt))
 
-(define (update-x x)
-  (set-vec2-x! position x))
+(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))))
+(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 @@ -165,7 +165,7 @@ 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