diff options
Diffstat (limited to 'manuals/chickadee/Sprites.html')
-rw-r--r-- | manuals/chickadee/Sprites.html | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/manuals/chickadee/Sprites.html b/manuals/chickadee/Sprites.html index 0c114bd..29d16ea 100644 --- a/manuals/chickadee/Sprites.html +++ b/manuals/chickadee/Sprites.html @@ -16,21 +16,21 @@ 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.3, http://www.gnu.org/software/texinfo/ --> +<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> <head> -<title>The Chickadee Game Toolkit: Sprites</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>Sprites (The Chickadee Game Toolkit)</title> -<meta name="description" content="The Chickadee Game Toolkit: Sprites"> -<meta name="keywords" content="The Chickadee Game Toolkit: Sprites"> +<meta name="description" content="Sprites (The Chickadee Game Toolkit)"> +<meta name="keywords" content="Sprites (The Chickadee Game Toolkit)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="index.html#Top" rel="start" title="Top"> <link href="Index.html#Index" rel="index" title="Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Graphics.html#Graphics" rel="up" title="Graphics"> -<link href="Lines-and-Shapes.html#Lines-and-Shapes" rel="next" title="Lines and Shapes"> +<link href="Tile-Maps.html#Tile-Maps" rel="next" title="Tile Maps"> <link href="Textures.html#Textures" rel="prev" title="Textures"> <style type="text/css"> <!-- @@ -90,11 +90,11 @@ ul.no-bullet {list-style: none} <a name="Sprites"></a> <div class="header"> <p> -Next: <a href="Lines-and-Shapes.html#Lines-and-Shapes" accesskey="n" rel="next">Lines and Shapes</a>, Previous: <a href="Textures.html#Textures" accesskey="p" rel="prev">Textures</a>, Up: <a href="Graphics.html#Graphics" accesskey="u" rel="up">Graphics</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> +Next: <a href="Tile-Maps.html#Tile-Maps" accesskey="n" rel="next">Tile Maps</a>, Previous: <a href="Textures.html#Textures" accesskey="p" rel="prev">Textures</a>, Up: <a href="Graphics.html#Graphics" accesskey="u" rel="up">Graphics</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> </div> <hr> <a name="Sprites-1"></a> -<h4 class="subsection">2.4.3 Sprites</h4> +<h4 class="subsection">2.3.3 Sprites</h4> <p>For those who are new to this game, a sprite is a 2D rectangular bitmap that is rendered to the screen. For 2D games, sprites are the @@ -104,8 +104,25 @@ stored in textures (see <a href="Textures.html#Textures">Textures</a>) and can b via the <code>draw-sprite</code> procedure. </p> <dl> -<dt><a name="index-draw_002dsprite"></a>Scheme Procedure: <strong>draw-sprite</strong> <em><var>texture</var> <var>region</var> [#:scale] [#:rotation] [#:blend-mode alpha] [#:texture-region] [#:shader]</em></dt> -</dl> +<dt><a name="index-draw_002dsprite"></a>Procedure: <strong>draw-sprite</strong> <em><var>texture</var> <var>position</var> [#:origin] [#:scale] [#:rotation] [#:blend-mode alpha] [#:rect] [#:shader]</em></dt> +<dd> +<p>Draw <var>texture</var> at <var>position</var>. +</p> +<p>Optionally, other transformations may be applied to the sprite. +<var>rotation</var> specifies the angle to rotate the sprite, in radians. +<var>scale</var> specifies the scaling factor as a 2D vector. All +transformations are applied relative to <var>origin</var>, a 2D vector, +which defaults to the lower-left corner. +</p> +<p>Alpha blending is used by default but the blending method can be +changed by specifying <var>blend-mode</var>. +</p> +<p>The area drawn to is as big as the texture, by default. To draw to an +arbitrary section of the screen, specify <var>rect</var>. +</p> +<p>Finally, advanced users may specify <var>shader</var> to change the way the +sprite is rendered entirely. +</p></dd></dl> <p>It’s not uncommon to need to draw hundreds or thousands of sprites each frame. However, GPUs (graphics processing units) are tricky @@ -129,7 +146,7 @@ the code that is calling <code>draw-sprite</code> a lot in the <code>with-batched-sprites</code> form. </p> <dl> -<dt><a name="index-with_002dbatched_002dsprites"></a>Scheme Syntax: <strong>with-batched-sprites</strong> <em><var>body</var> …</em></dt> +<dt><a name="index-with_002dbatched_002dsprites"></a>Syntax: <strong>with-batched-sprites</strong> <em><var>body</var> …</em></dt> <dd><p>Use batched rendering for all <code>draw-sprite</code> calls within <var>body</var>. </p></dd></dl> @@ -158,7 +175,7 @@ patch, they can be rendered at any size without unappealing scaling artifacts. </p> <dl> -<dt><a name="index-draw_002dnine_002dpatch"></a>Scheme Procedure: <strong>draw-nine-patch</strong> <em><var>texture</var> <var>region</var> [#:margin 0] [#:top-margin margin] [#:bottom-margin margin] [#:left-margin margin] [#:right-margin margin] [#:texture-region] [#:scale] [#:rotation] [#:blend-mode alpha] [#:shader]</em></dt> +<dt><a name="index-draw_002dnine_002dpatch"></a>Procedure: <strong>draw-nine-patch</strong> <em><var>texture</var> <var>rect</var> [#:margin 0] [#:top-margin margin] [#:bottom-margin margin] [#:left-margin margin] [#:right-margin margin] [#:origin] [#:scale] [#:rotation] [#:blend-mode alpha] [#:shader]</em></dt> <dd> <p>Draw a nine patch sprite. A nine patch sprite renders <var>texture</var> as a <var>width</var> x <var>height</var> rectangle whose stretchable areas are @@ -174,7 +191,7 @@ the other arguments. <hr> <div class="header"> <p> -Next: <a href="Lines-and-Shapes.html#Lines-and-Shapes" accesskey="n" rel="next">Lines and Shapes</a>, Previous: <a href="Textures.html#Textures" accesskey="p" rel="prev">Textures</a>, Up: <a href="Graphics.html#Graphics" accesskey="u" rel="up">Graphics</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> +Next: <a href="Tile-Maps.html#Tile-Maps" accesskey="n" rel="next">Tile Maps</a>, Previous: <a href="Textures.html#Textures" accesskey="p" rel="prev">Textures</a>, Up: <a href="Graphics.html#Graphics" accesskey="u" rel="up">Graphics</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> </div> |