From af2872325ed461252303ec8b7987058b664843f1 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 10 Mar 2018 20:32:18 -0500 Subject: Update Chickadee manual. --- manuals/chickadee/API-Reference.html | 23 +++ manuals/chickadee/Audio.html | 97 +++++++++- manuals/chickadee/Blending-and-Depth-Testing.html | 29 ++- manuals/chickadee/Copying-This-Manual.html | 23 +++ manuals/chickadee/Fonts.html | 197 +++++++++++++++++++++ manuals/chickadee/Framebuffers.html | 25 ++- .../chickadee/GNU-Free-Documentation-License.html | 23 +++ manuals/chickadee/Graphics.html | 41 ++++- manuals/chickadee/Index.html | 66 +++++++ manuals/chickadee/Input.html | 23 +++ manuals/chickadee/Installation.html | 23 +++ manuals/chickadee/Kernel.html | 30 +++- manuals/chickadee/Lines-and-Shapes.html | 46 ++++- manuals/chickadee/Math.html | 23 +++ manuals/chickadee/Matrices.html | 23 +++ manuals/chickadee/Rectangles.html | 23 +++ manuals/chickadee/Rendering-Engine.html | 33 +++- manuals/chickadee/Requirements.html | 23 +++ manuals/chickadee/Shaders.html | 25 ++- manuals/chickadee/Sprites.html | 109 +++++++++++- manuals/chickadee/Textures.html | 36 +++- manuals/chickadee/Vectors.html | 23 +++ manuals/chickadee/Vertex-Arrays.html | 25 ++- manuals/chickadee/Viewports.html | 25 ++- manuals/chickadee/index.html | 40 ++++- 25 files changed, 1008 insertions(+), 46 deletions(-) create mode 100644 manuals/chickadee/Fonts.html diff --git a/manuals/chickadee/API-Reference.html b/manuals/chickadee/API-Reference.html index bee3d9d..0dcd1de 100644 --- a/manuals/chickadee/API-Reference.html +++ b/manuals/chickadee/API-Reference.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Audio.html b/manuals/chickadee/Audio.html index 2f20199..755efb9 100644 --- a/manuals/chickadee/Audio.html +++ b/manuals/chickadee/Audio.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + @@ -73,8 +96,80 @@ Previous:

2.5 Audio

-

There is no audio support yet. Stay tuned! +

Chickadee has two data types for audio: samples and music. Samples +are for short sound effects like explosions. Music is for, well, +uh…, music.

+

Supported file formats include WAV and OGG. +

+
+
Scheme Procedure: load-sample file
+

Load audio sample from file. +

+ +
+
Scheme Procedure: set-sample-volume! volume
+

Set the volume that all samples are played at to volume, an +integer value between 0 and 128. +

+ +
+
Scheme Procedure: play-sample sample
+

Play sample. Pretty straightforward! +

+ +
+
Scheme Procedure: load-music file
+

Load music from file. +

+ +
+
Scheme Procedure: music-volume
+

Return the volume level for music, an integer value between 0 and 128. +

+ +
+
Scheme Procedure: set-music-volume! volume
+

Set the volume that music is played at to volume, an integer +value between 0 and 128. +

+ +
+
Scheme Procedure: play-music music [loop?]
+

Play music. If loop?, play it over and over and over and +over and… +

+ +
+
Scheme Procedure: pause-music
+

Pause the current music track. +

+ +
+
Scheme Procedure: resume-music
+

Resume the current music track. +

+ +
+
Scheme Procedure: rewind-music
+

estart the current music track from the beginning. +

+ +
+
Scheme Procedure: stop-music
+

Stop playing the current music track. +

+ +
+
Scheme Procedure: music-playing?
+

Return #t if music is currently playing. +

+ +
+
Scheme Procedure: music-paused?
+

Return #t if music is currently paused. +

+ diff --git a/manuals/chickadee/Blending-and-Depth-Testing.html b/manuals/chickadee/Blending-and-Depth-Testing.html index 0c0aaa3..72b6140 100644 --- a/manuals/chickadee/Blending-and-Depth-Testing.html +++ b/manuals/chickadee/Blending-and-Depth-Testing.html @@ -31,7 +31,7 @@ http://www.texinfo.org/ (GNU Texinfo). - + + @@ -67,11 +90,11 @@ ul.no-bullet {list-style: none}

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

+Next: , Previous: , Up: Graphics   [Contents][Index]


-

2.4.5 Blending and Depth Testing

+

2.4.6 Blending and Depth Testing

diff --git a/manuals/chickadee/Copying-This-Manual.html b/manuals/chickadee/Copying-This-Manual.html index f8bef99..493541d 100644 --- a/manuals/chickadee/Copying-This-Manual.html +++ b/manuals/chickadee/Copying-This-Manual.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Fonts.html b/manuals/chickadee/Fonts.html new file mode 100644 index 0000000..198bddb --- /dev/null +++ b/manuals/chickadee/Fonts.html @@ -0,0 +1,197 @@ + + + + + +The Chickadee Game Toolkit: Fonts + + + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+
+ +

2.4.5 Fonts

+ +

Unlike the traditional TrueType font format that many are accustomed +to, Chickadee loads and renders bitmap fonts in the +Angel Code format. But why use this seemingly obscure format? It’s +easy to find TTFs but not easy to find FNTs (the canonical file +extension used for Angel Code fonts) and bitmap fonts don’t scale +well. The reason is efficiency. +

+

If all of the glyphs of a font are pre-rendered and packed into an +image file then it becomes possible to use a texture atlas +(see Textures) and a sprite batch (see Sprites) when +rendering, which is a more efficient way to render fonts than using, +say, SDL_ttf or other +solutions that involve using the FreeType library directly. +

+

Now what about scaling? In libraries that use TTF fonts, one must +choose the size that the glyphs will be rasterized at up front. To +use n sizes of the same font, one must load n variants +of that font. If the size of the text is dynamic, some kind of +texture scaling algorithm must be used and the text will inevitably +look blurry. At first glance, using bitmap fonts seem to have an even +worse issue. Instead of just loading the same font n times at +different sizes, one would need to generate n image files for +each font size needed. This is where the “signed distance field” +rendering technique comes in. Introduced by +Valve in 2007, signed distance field fonts can be efficiently stored +in a bitmap and be rendered at arbitrary scale factors with good +results. Chickadee can render both traditional bitmap fonts and +signed distance field fonts. Signed distance field font +rendering is not yet available, so be patient. +

+

While Chickadee does not yet offer a tool for converting TTF fonts +into FNT fonts, tools such as +Hiero may be used +in the meantime. +

+

The following procedures can be found in the (chickadee render +font) module. +

+
+
Scheme Procedure: load-font file
+

Load the Angel Code formatted XML document in file and return a +new font object. +

+ +
+
Scheme Procedure: font? obj
+

Return #t if obj is a font object. +

+ +
+
Scheme Procedure: font-face font
+

Return the name of font. +

+ +
+
Scheme Procedure: font-line-height font
+

Return the line height of font. +

+ +
+
Scheme Procedure: font-line-height font
+

Return the line height of font. +

+ +
+
Scheme Procedure: font-bold? font
+

Return #t if font is a bold font. +

+ +
+
Scheme Procedure: font-italic? font
+

Return #t if font is an italicized font. +

+ +
+
Scheme Procedure: draw-text font text position
+

[#:scale] [#:rotation] [#:blend-mode] +

+

Draw the string text with the first character starting at +position using font. +

+
+
(draw-text font "Hello, world!" (vec2 128.0 128.0))
+
+ +

Refer to draw-sprite (see Sprites) for information about +the other arguments. +

+ +
+
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+ + + + + diff --git a/manuals/chickadee/Framebuffers.html b/manuals/chickadee/Framebuffers.html index fd0c64f..c57a82a 100644 --- a/manuals/chickadee/Framebuffers.html +++ b/manuals/chickadee/Framebuffers.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + @@ -71,7 +94,7 @@ Next: ,
-

2.4.8 Framebuffers

+

2.4.9 Framebuffers

diff --git a/manuals/chickadee/GNU-Free-Documentation-License.html b/manuals/chickadee/GNU-Free-Documentation-License.html index ea990ae..62ad23f 100644 --- a/manuals/chickadee/GNU-Free-Documentation-License.html +++ b/manuals/chickadee/GNU-Free-Documentation-License.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Graphics.html b/manuals/chickadee/Graphics.html index efe6df6..0afe5bc 100644 --- a/manuals/chickadee/Graphics.html +++ b/manuals/chickadee/Graphics.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + @@ -85,21 +108,23 @@ blocks to implement additional rendering techniques. - + - - - - - - - diff --git a/manuals/chickadee/Index.html b/manuals/chickadee/Index.html index 3863270..3c1df5e 100644 --- a/manuals/chickadee/Index.html +++ b/manuals/chickadee/Index.html @@ -56,8 +56,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + @@ -80,6 +103,8 @@ Previous: D   +F +   G   K @@ -88,10 +113,14 @@ Previous: M   +P +   Q   R   +S +   T   U @@ -124,6 +153,18 @@ Previous:
D draw-hookKernel +draw-lineLines and Shapes +draw-nine-patchSprites +draw-spriteSprites +draw-textFonts +
+F +font-bold?Fonts +font-faceFonts +font-italic?Fonts +font-line-heightFonts +font-line-heightFonts +font?Fonts
G gpu-applyRendering Engine @@ -134,20 +175,38 @@ Previous: key-release-hookKernel
L +load-fontFonts load-hookKernel load-imageTextures +load-musicAudio +load-sampleAudio
M mouse-move-hookKernel mouse-press-hookKernel mouse-release-hookKernel +music-paused?Audio +music-playing?Audio +music-volumeAudio +
+P +pause-musicAudio +play-musicAudio +play-sampleAudio
Q quit-hookKernel
R +resume-musicAudio +rewind-musicAudio run-gameKernel
+S +set-music-volume!Audio +set-sample-volume!Audio +stop-musicAudio +
T text-input-hookKernel timeKernel @@ -156,6 +215,7 @@ Previous: update-hookKernel
W +with-batched-spritesSprites with-blend-modeRendering Engine with-depth-testRendering Engine with-framebufferRendering Engine @@ -172,6 +232,8 @@ Previous: D   +F +   G   K @@ -180,10 +242,14 @@ Previous: M   +P +   Q   R   +S +   T   U diff --git a/manuals/chickadee/Input.html b/manuals/chickadee/Input.html index 3c25932..d559126 100644 --- a/manuals/chickadee/Input.html +++ b/manuals/chickadee/Input.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Installation.html b/manuals/chickadee/Installation.html index f9f3629..a362263 100644 --- a/manuals/chickadee/Installation.html +++ b/manuals/chickadee/Installation.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Kernel.html b/manuals/chickadee/Kernel.html index c9d635b..589c71e 100644 --- a/manuals/chickadee/Kernel.html +++ b/manuals/chickadee/Kernel.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + @@ -95,10 +118,9 @@ There are many hooks available, so read on to learn about all of them. For information about using Guile’s hook API, see See Hooks in GNU Guile Reference Manual.

-
Scheme Procedure: run-game [#:window-title "Chickadee!"]
-

[#:window-width 640] [#:window-height 480] [#:window-fullscreen? #f] - [#:update-hz 60] -Start the event loop. This procedure will not return until +

Scheme Procedure: run-game [#:window-title "Chickadee!"] [#:window-width 640] [#:window-height 480] [#:window-fullscreen? #f] [#:update-hz 60]
+
+

Start the event loop. This procedure will not return until abort-game is called.

The update-hook will be run update-hz times per second. diff --git a/manuals/chickadee/Lines-and-Shapes.html b/manuals/chickadee/Lines-and-Shapes.html index 01fac7b..13232ab 100644 --- a/manuals/chickadee/Lines-and-Shapes.html +++ b/manuals/chickadee/Lines-and-Shapes.html @@ -30,7 +30,7 @@ http://www.texinfo.org/ (GNU Texinfo). - + + @@ -67,11 +90,28 @@ ul.no-bullet {list-style: none}

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

+Next: , Previous: , Up: Graphics   [Contents][Index]


-

2.4.3 Lines and Shapes

+

2.4.4 Lines and Shapes

+ +

Sprites are fun, but sometimes simple, untextured lines and polygons +are desired. That’s where the (chickadee render shapes) module +comes in! +

+
+
Scheme Procedure: draw-line start end [#:thickness 0.5] [#:feather 1.0] [#:cap round] [#:color] [#:shader]
+
+

Draw a line segment from start to end. The line will be +thickness pixels thick with an antialiased border feather +pixels wide. The line will be colored color. cap +specifies the type of end cap that should be used to terminate the +lines, either none, butt, square, round, +triangle-in, or triangle-out. Advanced users may use +the shader argument to override the built-in line segment +shader. +

diff --git a/manuals/chickadee/Math.html b/manuals/chickadee/Math.html index 0204efc..fcf9746 100644 --- a/manuals/chickadee/Math.html +++ b/manuals/chickadee/Math.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Matrices.html b/manuals/chickadee/Matrices.html index f84f62d..8630efd 100644 --- a/manuals/chickadee/Matrices.html +++ b/manuals/chickadee/Matrices.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Rectangles.html b/manuals/chickadee/Rectangles.html index 743db15..6d0c9e8 100644 --- a/manuals/chickadee/Rectangles.html +++ b/manuals/chickadee/Rectangles.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Rendering-Engine.html b/manuals/chickadee/Rendering-Engine.html index b4514db..9bc09da 100644 --- a/manuals/chickadee/Rendering-Engine.html +++ b/manuals/chickadee/Rendering-Engine.html @@ -30,7 +30,7 @@ http://www.texinfo.org/ (GNU Texinfo). - + + @@ -67,7 +90,7 @@ ul.no-bullet {list-style: none}

-Next: , Up: Graphics   [Contents][Index]

+Next: , Up: Graphics   [Contents][Index]


@@ -90,8 +113,8 @@ would be tedious to have to have to specify them each time (chickadee render) module.

-
Scheme Syntax: gpu-apply shader vertex-array [#:uniform-key uniform-value ...]
-
Scheme Syntax: gpu-apply* shader vertex-array count [#:uniform-key uniform-value ...]
+
Scheme Syntax: gpu-apply shader vertex-array [#:uniform-key uniform-value ...]
+
Scheme Syntax: gpu-apply* shader vertex-array count [#:uniform-key uniform-value ...]

Render vertex-array using shader with the uniform values specified in the following keyword arguments. @@ -174,7 +197,7 @@ is #f, or enabled otherwise.


-Next: , Up: Graphics   [Contents][Index]

+Next: , Up: Graphics   [Contents][Index]

diff --git a/manuals/chickadee/Requirements.html b/manuals/chickadee/Requirements.html index 53927d7..d3e9918 100644 --- a/manuals/chickadee/Requirements.html +++ b/manuals/chickadee/Requirements.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Shaders.html b/manuals/chickadee/Shaders.html index a0e7637..7b3a2a0 100644 --- a/manuals/chickadee/Shaders.html +++ b/manuals/chickadee/Shaders.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + @@ -71,7 +94,7 @@ Next: -

2.4.7 Shaders

+

2.4.8 Shaders

Shaders are programs for the GPU to evaluate. They are written in the OpenGL Shading Language, or GLSL. Chickadee does not currently diff --git a/manuals/chickadee/Sprites.html b/manuals/chickadee/Sprites.html index 700941b..0c114bd 100644 --- a/manuals/chickadee/Sprites.html +++ b/manuals/chickadee/Sprites.html @@ -31,7 +31,7 @@ http://www.texinfo.org/ (GNU Texinfo). - + + @@ -67,12 +90,92 @@ ul.no-bullet {list-style: none}

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

+Next: , Previous: , Up: Graphics   [Contents][Index]


-

2.4.2 Sprites

+

2.4.3 Sprites

+ +

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 +most essential graphical abstraction. They are used for drawing maps, +players, NPCs, items, particles, text, etc. In Chickadee, bitmaps are +stored in textures (see Textures) and can be used to draw sprites +via the draw-sprite procedure. +

+
+
Scheme Procedure: draw-sprite texture region [#:scale] [#:rotation] [#:blend-mode alpha] [#:texture-region] [#:shader]
+
+ +

It’s not uncommon to need to draw hundreds or thousands of sprites +each frame. However, GPUs (graphics processing units) are tricky +beasts that prefer to be sent few, large chunks of data to render +rather than many, small chunks. Using draw-sprite on its own +will involve at least one GPU call per sprite, which will +quickly lead to poor performance. To deal with this, a technique +known as “sprite batching” can be used. Instead of drawing each +sprite immediately, the sprite batch will build up a large of buffer +of sprites to draw and defer rendering until the last possible moment. +Batching isn’t a panacea, though. Batching only works if the sprites +being drawn share as much in common as possible. Every time you draw +a sprite with a different texture or blend mode, the batch will be +sent off to the GPU. Therefore, batching is most useful if you +minimize such changes. A good strategy for reducing texture changes +is to stuff many bitmaps into a single image file and create a +“texture atlas” (see Textures) to access the sub-images within. +

+

Taking advantage of sprite batching in Chickadee is easy, just wrap +the code that is calling draw-sprite a lot in the +with-batched-sprites form. +

+
+
Scheme Syntax: with-batched-sprites body
+

Use batched rendering for all draw-sprite calls within +body. +

+ +

With a basic sprite abstraction in place, it’s possible to build other +abstractions on top of it. One such example is the “nine patch”. A +nine patch is a sprite that can be rendered at various sizes without +becoming distorted. This is achieved by diving up the sprite into +nine regions: +

+
    +
  • the center, which can be scaled horizontally and vertically +
  • the four corners, which can never be scaled +
  • the left and right sides, which can be scaled vertically +
  • the top and bottom sides, which can be scaled horizontally +
+

The one caveat is that the bitmap regions must be designed in such a +way so that they are not distorted when stretched along the affected +axes. For example, that means that the top and bottom sides could +have varying colored pixels vertically, but not horizontally. +

+

The most common application of this technique is for graphical user +interface widgets like buttons and dialog boxes. By using a nine +patch, they can be rendered at any size without unappealing scaling +artifacts. +

+
+
Scheme Procedure: draw-nine-patch texture region [#:margin 0] [#:top-margin margin] [#:bottom-margin margin] [#:left-margin margin] [#:right-margin margin] [#:texture-region] [#:scale] [#:rotation] [#:blend-mode alpha] [#:shader]
+
+

Draw a nine patch sprite. A nine patch sprite renders texture +as a width x height rectangle whose stretchable areas are +defined by the given margin measurements top-margin, +bottom-margin, left-margin, and right-margin. The +margin argument may be used to configure all four margins at +once. +

+

Refer to draw-sprite (see Sprites) for information about +the other arguments. +

+ +
+
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
diff --git a/manuals/chickadee/Textures.html b/manuals/chickadee/Textures.html index a31d6fb..66d9fe7 100644 --- a/manuals/chickadee/Textures.html +++ b/manuals/chickadee/Textures.html @@ -30,8 +30,8 @@ http://www.texinfo.org/ (GNU Texinfo). - - + + + @@ -67,16 +90,15 @@ ul.no-bullet {list-style: none}
-

2.4.4 Textures

+

2.4.2 Textures

-
Scheme Procedure: load-image file [#:min-filter nearest]
-

[#:mag-filter nearest] [#:wrap-s repeat] [#:wrap-t repeat] -

+
Scheme Procedure: load-image file [#:min-filter nearest] [#:mag-filter nearest] [#:wrap-s repeat] [#:wrap-t repeat]
+

Load the image data from file and return a new texture object.

min-filter and mag-filter describe the method that should diff --git a/manuals/chickadee/Vectors.html b/manuals/chickadee/Vectors.html index 8a624ff..eb79149 100644 --- a/manuals/chickadee/Vectors.html +++ b/manuals/chickadee/Vectors.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + diff --git a/manuals/chickadee/Vertex-Arrays.html b/manuals/chickadee/Vertex-Arrays.html index 72b0273..9b3f5b1 100644 --- a/manuals/chickadee/Vertex-Arrays.html +++ b/manuals/chickadee/Vertex-Arrays.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + @@ -71,7 +94,7 @@ Next: , Previ


-

2.4.6 Vertex Arrays

+

2.4.7 Vertex Arrays

diff --git a/manuals/chickadee/Viewports.html b/manuals/chickadee/Viewports.html index f55d386..c54e7c9 100644 --- a/manuals/chickadee/Viewports.html +++ b/manuals/chickadee/Viewports.html @@ -57,8 +57,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + @@ -71,7 +94,7 @@ Previous: -

2.4.9 Viewports

+

2.4.10 Viewports

diff --git a/manuals/chickadee/index.html b/manuals/chickadee/index.html index d044f9f..b10ea67 100644 --- a/manuals/chickadee/index.html +++ b/manuals/chickadee/index.html @@ -56,8 +56,31 @@ span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} +@media (min-width: 1140px) { + body { + margin-left: 14rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (min-width: 800px) and (max-width: 1140px) { + body { + margin-left: 6rem; + margin-right: 4rem; + max-width: 52rem; + } +} + +@media (max-width: 800px) { + body { + margin: 1rem; + } +} + --> + @@ -89,14 +112,15 @@ ul.no-bullet {list-style: none}
  • 2.4 Graphics
  • 2.5 Audio
  • -- cgit v1.2.3