From af2872325ed461252303ec8b7987058b664843f1 Mon Sep 17 00:00:00 2001
From: David Thompson 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.
+ Set the volume that all samples are played at to volume, an
+integer value between 0 and 128.
+ Return the volume level for music, an integer value between 0 and 128.
+ Set the volume that music is played at to volume, an integer
+value between 0 and 128.
+ Play music. If loop?, play it over and over and over and
+over and…
+
-Next: Vertex Arrays, Previous: Textures, Up: Graphics [Contents][Index]
+Next: Blending and Depth Testing, Previous: Lines and Shapes, Up: Graphics [Contents][Index] 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 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 Load the Angel Code formatted XML document in file and return a
+new font object.
+ [#:scale] [#:rotation] [#:blend-mode]
+ Draw the string text with the first character starting at
+position using font.
+ Refer to
+Next: Blending and Depth Testing, Previous: Lines and Shapes, Up: Graphics [Contents][Index]2.5 Audio
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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}
-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 @@
+
+
+
+
+
+
+
+2.4.5 Fonts
+
+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.
+(chickadee render
+font)
module.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+(draw-text font "Hello, world!" (vec2 128.0 128.0))
+
draw-sprite
(see Sprites) for information about
+the other arguments.
+
+
-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:
-• Rendering Engine: Rendering state management.
• Sprites: Draw 2D images.
+
+• Textures: 2D images.
+
-• Sprites: Draw 2D images.
• Lines and Shapes: Draw line segments and polygons.
+
-• Lines and Shapes: Draw line segments and polygons.
• Textures: 2D images.
+
-• Fonts: Drawing text.
• Blending and Depth Testing: Control how pixels are combined.
+
-• Blending and Depth Testing: Control how pixels are combined.
• Vertex Arrays: Create 2D/3D models.
+
-• Vertex Arrays: Create 2D/3D models.
• Shaders: Create custom GPU programs.
+
-• Shaders: Create custom GPU programs.
• Framebuffers: Render to texture.
+
-• Framebuffers: Render to texture.
• Viewports: Restrict rendering to
+ • Viewports: Restrict rendering to
D
+draw-hook
: Kernel
+draw-line
: Lines and Shapes
+draw-nine-patch
: Sprites
+draw-sprite
: Sprites
+draw-text
: Fonts
+
+F
+font-bold?
: Fonts
+font-face
: Fonts
+font-italic?
: Fonts
+font-line-height
: Fonts
+font-line-height
: Fonts font?
: Fonts G
@@ -134,20 +175,38 @@ Previous: gpu-apply
: Rendering Engine key-release-hook
: Kernel
+L load-font
: Fonts load-hook
: Kernel
+load-image
: Textures
+load-music
: Audio load-sample
: Audio M mouse-move-hook
: Kernel mouse-press-hook
: Kernel
+mouse-release-hook
: Kernel
+music-paused?
: Audio
+music-playing?
: Audio
+music-volume
: Audio
+
+P
+pause-music
: Audio
+play-music
: Audio play-sample
: Audio Q quit-hook
: Kernel
+R
+resume-music
: Audio rewind-music
: Audio run-game
: Kernel
+
+S
+set-music-volume!
: Audio
+set-sample-volume!
: Audio
+stop-music
: Audio T text-input-hook
: Kernel
@@ -156,6 +215,7 @@ Previous: time
: Kernel update-hook
: Kernel
+W with-batched-sprites
: Sprites with-blend-mode
: Rendering Engine with-depth-test
: Rendering 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.
with-framebuffer
: Rendering Engine
[#:window-width 640] [#:window-height 480] [#:window-fullscreen? #f] - [#:update-hz 60] -Start the event loop. This procedure will not return until +
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: Textures, Previous: Sprites, Up: Graphics [Contents][Index]
+Next: Fonts, Previous: Sprites, Up: Graphics [Contents][Index]Sprites are fun, but sometimes simple, untextured lines and polygons
+are desired. That’s where the (chickadee render shapes)
module
+comes in!
+
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.
+
(chickadee render)
module.
Render vertex-array using shader with the uniform values
specified in the following keyword arguments.
@@ -174,7 +197,7 @@ is #f
, or enabled otherwise.
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: Lines and Shapes, Previous: Rendering Engine, Up: Graphics [Contents][Index]
+Next: Lines and Shapes, Previous: Textures, Up: Graphics [Contents][Index]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.
+
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.
+
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 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. +
+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: Lines and Shapes, Previous: Textures, Up: Graphics [Contents][Index]
+-Next: Blending and Depth Testing, Previous: Lines and Shapes, Up: Graphics [Contents][Index]
+Next: Sprites, Previous: Rendering Engine, Up: Graphics [Contents][Index][#: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: Shaders, Previ