diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-05-24 08:09:03 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2023-05-24 08:09:03 -0400 |
commit | 03072ef67af0623758a660e2cd3fb5e153133efa (patch) | |
tree | eea30b2b8fd47aa7d1bd6494ed64b4313f03eb4a /manuals/chickadee/Getting-Started.html | |
parent | bcccc363a3b814930856be06c52914fb88c2ece6 (diff) |
Update chickadee manual.
Diffstat (limited to 'manuals/chickadee/Getting-Started.html')
-rw-r--r-- | manuals/chickadee/Getting-Started.html | 88 |
1 files changed, 44 insertions, 44 deletions
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 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> -<!-- Copyright (C) 2017-2021 David Thompson davet@gnu.org +<!-- Copyright (C) 2017-2023 David Thompson dthompson2@worcester.edu Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 @@ -17,25 +17,25 @@ Foundation Web site at http://www.gnu.org/licenses/fdl.html. The document was typeset with http://www.texinfo.org/ (GNU Texinfo). - --> -<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> + --> +<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> <head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Getting Started (The Chickadee Game Toolkit)</title> -<meta name="description" content="Getting Started (The Chickadee Game Toolkit)"> -<meta name="keywords" content="Getting Started (The Chickadee Game Toolkit)"> -<meta name="resource-type" content="document"> -<meta name="distribution" content="global"> -<meta name="Generator" content="makeinfo"> -<link href="index.html" rel="start" title="Top"> -<link href="Index.html" rel="index" title="Index"> -<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> -<link href="index.html" rel="up" title="Top"> -<link href="Command-Line-Interface.html" rel="next" title="Command Line Interface"> -<link href="Requirements.html" rel="prev" title="Requirements"> +<meta name="description" content="Getting Started (The Chickadee Game Toolkit)" /> +<meta name="keywords" content="Getting Started (The Chickadee Game Toolkit)" /> +<meta name="resource-type" content="document" /> +<meta name="distribution" content="global" /> +<meta name="Generator" content="makeinfo" /> +<link href="index.html" rel="start" title="Top" /> +<link href="Index.html" rel="index" title="Index" /> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents" /> +<link href="index.html" rel="up" title="Top" /> +<link href="Command-Line-Interface.html" rel="next" title="Command Line Interface" /> +<link href="Requirements.html" rel="prev" title="Requirements" /> <style type="text/css"> -<!-- +<!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} div.display {margin-left: 3.2em} @@ -72,9 +72,9 @@ ul.no-bullet {list-style: none} } } ---> +--> </style> -<link rel="stylesheet" type="text/css" href="https://dthompson.us/css/dthompson.css"> +<link rel="stylesheet" type="text/css" href="https://dthompson.us/css/dthompson.css" /> </head> @@ -84,15 +84,15 @@ ul.no-bullet {list-style: none} <p> Next: <a href="Command-Line-Interface.html" accesskey="n" rel="next">Command Line Interface</a>, Previous: <a href="Installation.html" accesskey="p" rel="prev">Installation</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p> </div> -<hr> +<hr /> <span id="Getting-Started-1"></span><h2 class="chapter">2 Getting Started</h2> <p>One of the simplest programs we can make with Chickadee is rendering the text “Hello, world” on screen. Here’s what that looks like: </p> -<div class="example"> -<pre class="example">(define (draw alpha) - (draw-text "Hello, world!" (vec2 64.0 240.0))) +<div class="lisp"> +<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-open">(</span><span class="syntax-symbol">draw</span> <span class="syntax-symbol">alpha</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">draw-text</span> <span class="syntax-string">"Hello, world!"</span> <span class="syntax-open">(</span><span class="syntax-symbol">vec2</span> <span class="syntax-symbol">64.0</span> <span class="syntax-symbol">240.0</span><span class="syntax-close">)</span><span class="syntax-close">)</span><span class="syntax-close">)</span> </pre></div> <p>The <code>draw</code> procedure is called frequently to draw the game scene. @@ -107,14 +107,14 @@ in this tutorial. <p>This is a good start, but it’s boring. Let’s make the text move! </p> -<div class="example"> -<pre class="example">(define position (vec2 0.0 240.0)) +<div class="lisp"> +<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-symbol">position</span> <span class="syntax-open">(</span><span class="syntax-symbol">vec2</span> <span class="syntax-symbol">0.0</span> <span class="syntax-symbol">240.0</span><span class="syntax-close">)</span><span class="syntax-close">)</span> -(define (draw alpha) - (draw-text "Hello, world!" position)) +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-open">(</span><span class="syntax-symbol">draw</span> <span class="syntax-symbol">alpha</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">draw-text</span> <span class="syntax-string">"Hello, world!"</span> <span class="syntax-symbol">position</span><span class="syntax-close">)</span><span class="syntax-close">)</span> -(define (update dt) - (set-vec2-x! position (+ (vec2-x position) (* 100.0 dt)))) +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-open">(</span><span class="syntax-symbol">update</span> <span class="syntax-symbol">dt</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">set-vec2-x!</span> <span class="syntax-symbol">position</span> <span class="syntax-open">(</span><span class="syntax-symbol">+</span> <span class="syntax-open">(</span><span class="syntax-symbol">vec2-x</span> <span class="syntax-symbol">position</span><span class="syntax-close">)</span> <span class="syntax-open">(</span><span class="syntax-symbol">*</span> <span class="syntax-symbol">100.0</span> <span class="syntax-symbol">dt</span><span class="syntax-close">)</span><span class="syntax-close">)</span><span class="syntax-close">)</span><span class="syntax-close">)</span> </pre></div> <p>The <code>vec2</code> 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. </p> -<div class="example"> -<pre class="example">(define position (vec2 0.0 240.0)) +<div class="lisp"> +<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-symbol">position</span> <span class="syntax-open">(</span><span class="syntax-symbol">vec2</span> <span class="syntax-symbol">0.0</span> <span class="syntax-symbol">240.0</span><span class="syntax-close">)</span><span class="syntax-close">)</span> -(define (draw alpha) - (draw-text "Hello, world!" position)) +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-open">(</span><span class="syntax-symbol">draw</span> <span class="syntax-symbol">alpha</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">draw-text</span> <span class="syntax-string">"Hello, world!"</span> <span class="syntax-symbol">position</span><span class="syntax-close">)</span><span class="syntax-close">)</span> -(define (update dt) - (update-agenda dt)) +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-open">(</span><span class="syntax-symbol">update</span> <span class="syntax-symbol">dt</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">update-agenda</span> <span class="syntax-symbol">dt</span><span class="syntax-close">)</span><span class="syntax-close">)</span> -(define (update-x x) - (set-vec2-x! position x)) +<span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-open">(</span><span class="syntax-symbol">update-x</span> <span class="syntax-symbol">x</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">set-vec2-x!</span> <span class="syntax-symbol">position</span> <span class="syntax-symbol">x</span><span class="syntax-close">)</span><span class="syntax-close">)</span> -(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)))) +<span class="syntax-open">(</span><span class="syntax-special">let</span> <span class="syntax-open">(</span><span class="syntax-open">(</span><span class="syntax-symbol">start</span> <span class="syntax-symbol">0.0</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">end</span> <span class="syntax-symbol">536.0</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">duration</span> <span class="syntax-symbol">4.0</span><span class="syntax-close">)</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">script</span> + <span class="syntax-open">(</span><span class="syntax-symbol">while</span> <span class="syntax-symbol">#t</span> + <span class="syntax-open">(</span><span class="syntax-symbol">tween</span> <span class="syntax-symbol">duration</span> <span class="syntax-symbol">start</span> <span class="syntax-symbol">end</span> <span class="syntax-symbol">update-x</span><span class="syntax-close">)</span> + <span class="syntax-open">(</span><span class="syntax-symbol">tween</span> <span class="syntax-symbol">duration</span> <span class="syntax-symbol">end</span> <span class="syntax-symbol">start</span> <span class="syntax-symbol">update-x</span><span class="syntax-close">)</span><span class="syntax-close">)</span><span class="syntax-close">)</span><span class="syntax-close">)</span> </pre></div> <p>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! </p> -<hr> +<hr /> <div class="header"> <p> Next: <a href="Command-Line-Interface.html" accesskey="n" rel="next">Command Line Interface</a>, Previous: <a href="Installation.html" accesskey="p" rel="prev">Installation</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p> |