chickadee.git
11 months agomath: vector: Fix vec2-normalize and vec3-normalize.
David Thompson [Mon, 10 Sep 2018 21:12:09 +0000 (17:12 -0400)] 
math: vector: Fix vec2-normalize and vec3-normalize.

* chickadee/math/vector.scm: Move vec2-normalize and vec3-normalize
  below the definitions of vec2-normalize! and vec3-normalize! so that
  inlining doesn't screw things up.

11 months agomath: vector: Add vec2*, vec2+, and vec2- procedures.
David Thompson [Mon, 10 Sep 2018 21:09:50 +0000 (17:09 -0400)] 
math: vector: Add vec2*, vec2+, and vec2- procedures.

* chickadee/math/vector.scm (vec2*, vec2+, vec2-): New procedures.

11 months agorender: asset: Don't use mipmaps for now.
David Thompson [Fri, 7 Sep 2018 21:34:28 +0000 (17:34 -0400)] 
render: asset: Don't use mipmaps for now.

Chickadee doesn't support them yet.

11 months agorender: asset: Use default sampler index of 0 when loading textures.
David Thompson [Fri, 7 Sep 2018 21:34:07 +0000 (17:34 -0400)] 
render: asset: Use default sampler index of 0 when loading textures.

11 months agorender: asset: Removing debug print calls.
David Thompson [Fri, 7 Sep 2018 21:33:52 +0000 (17:33 -0400)] 
render: asset: Removing debug print calls.

11 months agorender: scene: Make material factors default to 1.0.
David Thompson [Fri, 7 Sep 2018 21:33:21 +0000 (17:33 -0400)] 
render: scene: Make material factors default to 1.0.

11 months agorender: asset: Add material texture parsing and loading.
David Thompson [Fri, 7 Sep 2018 13:06:35 +0000 (09:06 -0400)] 
render: asset: Add material texture parsing and loading.

* chickadee/render/asset.scm (read-gltf): Parse and load all textures
referenced by materials.

11 months agorender: scene: Apply base color texture and factor.
David Thompson [Fri, 7 Sep 2018 13:03:43 +0000 (09:03 -0400)] 
render: scene: Apply base color texture and factor.

* chickadee/render/scene.scm (draw-primitive): Set base color texture
and send base color factor as uniform to shader.
* data/shaders/pbr/pbr-vert.glsl (texcoord_0): New input attribute.
(frag_tex): New output attribute.
* data/shaders/pbr/pbr-frag.glsl (frag_tex): New input attribute.
(base_color_factor, base_color_texture): New uniforms.

11 months agorender: scene: Merge metallic roughness into material record type.
David Thompson [Fri, 7 Sep 2018 12:52:25 +0000 (08:52 -0400)] 
render: scene: Merge metallic roughness into material record type.

* chickadee/render/scene.scm (<metallic-roughness>): Delete. Merge all
  fields into <material>.

11 months agorender: shader: Add support for vec3 uniform values.
David Thompson [Fri, 7 Sep 2018 12:52:03 +0000 (08:52 -0400)] 
render: shader: Add support for vec3 uniform values.

11 months agorender: gl: Re-export gl-uniform3fv.
David Thompson [Fri, 7 Sep 2018 12:51:22 +0000 (08:51 -0400)] 
render: gl: Re-export gl-uniform3fv.

* chickadee/render/gl.scm: Export gl-uniform3fv.

11 months agorender: scene: Stop allocating matrices when rendering.
David Thompson [Thu, 6 Sep 2018 16:19:22 +0000 (12:19 -0400)] 
render: scene: Stop allocating matrices when rendering.

* chickadee/render/scene.scm (<primitive>): Add matrix field.
(make-primitive): Call %make-primitive with additional matrix arg.
(<scene-node>): Add world-matrix field.
(make-scene-node): Call %make-scene-node with additional matrix arg.
(modelview): Delete.
(draw-primitive): Perform matrix multiplication without allocating.
(draw-scene-node): Likewise.
(draw-scene): Pass pre-built matrix rather than allocating.

11 months agodata: shaders: Update WIP PBR shaders.
David Thompson [Thu, 6 Sep 2018 13:39:37 +0000 (09:39 -0400)] 
data: shaders: Update WIP PBR shaders.

They don't *anything* related to PBR, but they allow me to test glTF
asset loading as I work towards full PBR support.

11 months agorender: buffer: Fix pointer argument to glVertexAttribPointer.
David Thompson [Thu, 6 Sep 2018 13:34:46 +0000 (09:34 -0400)] 
render: buffer: Fix pointer argument to glVertexAttribPointer.

This one was a doozy.  Took me days to figure out why something wasn't
rendering properly and this was the culprit!  The last argument, the
"pointer" argument, to glVertexAttribPointer is supposed to point to
the byte offset to start reading data from the VBO.  I thought this
meant that I could pass a pointer to an integer that contained the
offset.  WRONG!  The pointer value itself must encode that offset.
You can see in the diff that I knew this code didn't work when the
offset was 0, but somehow a null pointer worked and I just made that
case work while leaving every other offset broken.  The more I know!

* chickadee/render/buffer.scm (apply-typed-buffer): Pass a pointer
  whose address is the byte offset of the buffer, rather than a
  pointer whose dereferenced value is an integer representing the byte
  offset.

11 months agorender: buffer: Use correct data type for index buffer when rendering.
David Thompson [Thu, 6 Sep 2018 13:33:19 +0000 (09:33 -0400)] 
render: buffer: Use correct data type for index buffer when rendering.

* chickadee/render/buffer.scm (render-vertices): Use the index buffer
  type rather than assuming it is always unsigned-int.

11 months agorender: buffer: Stop using glBufferSubData when creating VBOs.
David Thompson [Thu, 6 Sep 2018 13:28:59 +0000 (09:28 -0400)] 
render: buffer: Stop using glBufferSubData when creating VBOs.

* chickadee/render/buffer.scm (make-buffer): Remove unnecessary call
  to glBufferSubData and just use glBufferData to do it all.

11 months agorender: buffer: Fixed default typed buffer length calculation.
David Thompson [Thu, 6 Sep 2018 13:27:46 +0000 (09:27 -0400)] 
render: buffer: Fixed default typed buffer length calculation.

* chickadee/render/buffer.scm (num-elements): New procedure.
  (make-typed-buffer): Default 'length' to the correct value in
  elements, not bytes, when a custom length is not specified.

11 months agorender: buffer: Orphan before mapping only when used for streaming.
David Thompson [Thu, 6 Sep 2018 13:25:34 +0000 (09:25 -0400)] 
render: buffer: Orphan before mapping only when used for streaming.

* chickdaee/render/buffer.scm (map-buffer!): Orphan buffer data only
  when the buffer usage is 'stream'.

11 months agorender: scene: Add better printers for primitives, meshes, and scenes.
David Thompson [Thu, 6 Sep 2018 13:24:23 +0000 (09:24 -0400)] 
render: scene: Add better printers for primitives, meshes, and scenes.

* chickadee/render/scene.scm (display-primitive, display-mesh,
  display-scene-node): New procedures.

11 months agorender: gl: Export gl-point-size.
David Thompson [Thu, 6 Sep 2018 13:22:35 +0000 (09:22 -0400)] 
render: gl: Export gl-point-size.

* chickadee/render/gl.scm (gl-point-size): New procedure alias.

11 months agomath: Add grid module.
David Thompson [Mon, 3 Sep 2018 02:12:27 +0000 (22:12 -0400)] 
math: Add grid module.

* chickadee/math/grid.scm: New file.
* examples/grid.scm: New file.
* Makefile.am (SOURCES): Add grid module.
(EXTRA_DIST): Add grid example.

11 months agoRemove default error handler.
David Thompson [Mon, 3 Sep 2018 02:08:34 +0000 (22:08 -0400)] 
Remove default error handler.

* chickadee.scm (default-error-handler): Delete.
(call-with-error-handling): Don't catch errors if no handler is
specified.
(run-game): Default 'error' arg to #f.
* chickadee/sdl.scm: (run-game/sdl): Likewise.

11 months agorender: shapes: Add simple (but slow) bezier curve rendering.
David Thompson [Wed, 29 Aug 2018 21:53:35 +0000 (17:53 -0400)] 
render: shapes: Add simple (but slow) bezier curve rendering.

* chickadee/render/shapes.scm (draw-bezier-curve, draw-bezier-path):
  New procedures.

11 months agoAdd bezier curve module.
David Thompson [Wed, 29 Aug 2018 21:52:59 +0000 (17:52 -0400)] 
Add bezier curve module.

* chickadee/math/bezier.scm: New file.
* Makefile.am (SOURCES): Add it.

11 months agorender: shapes: Allow matrix to be passed to draw-line.
David Thompson [Wed, 29 Aug 2018 21:38:59 +0000 (17:38 -0400)] 
render: shapes: Allow matrix to be passed to draw-line.

* chickadee/render/shapes.scm (draw-line): Add matrix argument.

11 months agoscripting: Add repeat macro.
David Thompson [Wed, 29 Aug 2018 11:58:35 +0000 (07:58 -0400)] 
scripting: Add repeat macro.

* chickadee/scripting.scm (repeat): New syntax.

11 months agoFix error handling logic.
David Thompson [Sun, 26 Aug 2018 02:07:07 +0000 (22:07 -0400)] 
Fix error handling logic.

* chickadee.scm (call-with-error-handling): Call the correct error
handler. Return #t if an error occurred, #f otherwise.
(run-game): Reset current-time and buffer after recovering from an
error.

11 months agoRemove custom backtrace display.
David Thompson [Sun, 26 Aug 2018 01:31:14 +0000 (21:31 -0400)] 
Remove custom backtrace display.

Always printing a backtrace caused double backtraces to be printed
when using the default error handler that just re-throws the error.

11 months agogit: Ignore html manual build artifacts.
David Thompson [Thu, 23 Aug 2018 11:48:24 +0000 (07:48 -0400)] 
git: Ignore html manual build artifacts.

11 months agoUpdate manual to reflect major API changes.
David Thompson [Tue, 21 Aug 2018 14:46:44 +0000 (10:46 -0400)] 
Update manual to reflect major API changes.

11 months agoAdd default game loop error handler.
David Thompson [Tue, 21 Aug 2018 14:45:35 +0000 (10:45 -0400)] 
Add default game loop error handler.

* chickadee.scm (default-error-handler): New procedure.
(run-game): Set default value for 'error' arg to
'default-error-handler'.
* chickadee/sdl.scm (run-game/sdl): Ditto.

11 months agoguix: Update guile-sdl2 to latest commit in master.
David Thompson [Tue, 21 Aug 2018 14:44:45 +0000 (10:44 -0400)] 
guix: Update guile-sdl2 to latest commit in 

11 months agoUpdate README.
David Thompson [Tue, 21 Aug 2018 00:33:30 +0000 (20:33 -0400)] 
Update README.

11 months agoMove SDL game loop implementation to its own module.
David Thompson [Tue, 21 Aug 2018 01:50:41 +0000 (21:50 -0400)] 
Move SDL game loop implementation to its own module.

11 months agomath: vector: Add read syntax.
David Thompson [Tue, 21 Aug 2018 00:22:44 +0000 (20:22 -0400)] 
math: vector: Add read syntax.

* chickadee/math/vector.scm (read-vec): New procedure.  Extend reader.
* examples/lines.scm: Use new vector read syntax.
* examples/nine-patch.scm: Ditto.
* examples/sprite.scm: Ditto.
* examples/text.scm: Ditto.
* examples/tiled.scm: Ditto.

11 months agowindow: Fix procedure export.
David Thompson [Mon, 20 Aug 2018 02:49:54 +0000 (22:49 -0400)] 
window: Fix procedure export.

* chickadee/window.scm: Export close-window! for real this time.

11 months agoMake the game loop modular!
David Thompson [Mon, 20 Aug 2018 02:49:12 +0000 (22:49 -0400)] 
Make the game loop modular!

This is really cool!  Now users can plug in whatever backend they'd
like and are not forced to use SDL and OpenGL.  Thanks to Chris Webber
for showing me the Lux library for Racket that does exactly this.

* chickadee.scm (run-game): Remove all SDL/OpenGL code, replace with
generic render/update keyword arguments.
(run-game/sdl): New procedure.
* examples/lines.scm: Update for API breakage.
* examples/nine-patch.scm: Ditto.
* examples/sprite.scm: Ditto.
* examples/text.scm: Ditto.
* examples/tiled.scm: Ditto.

13 months agoBump to version 0.3.0.
David Thompson [Wed, 11 Jul 2018 18:56:12 +0000 (14:56 -0400)] 
Bump to version 0.3.0.

13 months agoREADME: Update guile-sdl2 requirement.
David Thompson [Wed, 11 Jul 2018 18:36:57 +0000 (14:36 -0400)] 
README: Update guile-sdl2 requirement.

13 months agorender: Replace keyword->string from SRFI-88.
David Thompson [Tue, 10 Jul 2018 16:20:10 +0000 (12:20 -0400)] 
render: Replace keyword->string from SRFI-88.

SRFI-88 introduces a problematic global reader macro that I didn't
know about until Ricardo Wurmus reported some strange behavior that
was traced back to this SRFI.  Thanks to Ludovic Courtes for pointing
it out.

* chickadee/render.scm: Remove (srfi srfi-88) import.
(keyword->string): New procedure.

13 months agoguix: Update guile-sdl2 commit.
David Thompson [Tue, 10 Jul 2018 16:19:43 +0000 (12:19 -0400)] 
guix: Update guile-sdl2 commit.

13 months agoguix: Upgrade to Guile 2.2.4.
David Thompson [Mon, 9 Jul 2018 01:42:02 +0000 (21:42 -0400)] 
guix: Upgrade to Guile 2.2.4.

13 months agoFix Makefile.am.
David Thompson [Tue, 26 Jun 2018 19:42:08 +0000 (15:42 -0400)] 
Fix Makefile.am.

Accidentally removed the wrong buffer.scm!

13 months agoRemove problematic OpenGL requirements.
David Thompson [Mon, 25 Jun 2018 08:30:14 +0000 (04:30 -0400)] 
Remove problematic OpenGL requirements.

Trying to force certain GL versions and other attributes has only
caused problems for potential users thus far.  Let's see how far we
get by just removing this stuff.

* chickadee/window.scm (open-window): Remove OpenGL settings.
* chickadee/render/shapes.scm (draw-filled-rect, draw-line): Drop
shader version from 330 to 130.
* chickadee/render/sprite.scm (default-shader): Same.

13 months agoRemove experimental buffer API.
David Thompson [Mon, 25 Jun 2018 08:03:01 +0000 (04:03 -0400)] 
Remove experimental buffer API.

13 months agodoc: Add framebuffer docs.
David Thompson [Mon, 25 Jun 2018 07:50:56 +0000 (03:50 -0400)] 
doc: Add framebuffer docs.

* doc/api.texi (Framebuffers): Add basic API documentation.

13 months agoDisplay proper backtraces when there is no game loop error handler.
David Thompson [Sun, 24 Jun 2018 10:49:58 +0000 (06:49 -0400)] 
Display proper backtraces when there is no game loop error handler.

* chickadee.scm (call-with-error-handling): Do not catch errors when
the error hook has nothing in it.

13 months agorender: tiled: Add support for external tilesets.
David Thompson [Sun, 24 Jun 2018 10:41:57 +0000 (06:41 -0400)] 
render: tiled: Add support for external tilesets.

* chickadee/render/tiled.scm (load-tile-map): Handle both internal and
external tilesets.

13 months agoguix: Use Guile 2.2.2 for now.
David Thompson [Sun, 24 Jun 2018 10:28:49 +0000 (06:28 -0400)] 
guix: Use Guile 2.2.2 for now.

15 months agoerror: Pass error key and args to error hook.
David Thompson [Fri, 4 May 2018 03:49:34 +0000 (23:49 -0400)] 
error: Pass error key and args to error hook.

* chickadee.scm (call-with-error-handling): Run hook with error key
and args.

15 months agoAdd game loop error hook.
David Thompson [Fri, 4 May 2018 03:29:08 +0000 (23:29 -0400)] 
Add game loop error hook.

* chickadee.scm (error-hook): New variable.
(display-game-loop-error, call-with-error-handling): New procedures.
(run-hook*): New syntax.
(run-game): Wrap all hooks with error handling.

15 months agorender: font: Allow rendering of substrings.
David Thompson [Tue, 1 May 2018 01:13:00 +0000 (21:13 -0400)] 
render: font: Allow rendering of substrings.

* chickadee/render/font.scm (draw-text*, draw-text): Add start and end
arguments.
* doc/api.texi (Fonts): Document new arguments.

15 months agorender: tiled: Export draw-tile-map*.
David Thompson [Tue, 1 May 2018 00:58:35 +0000 (20:58 -0400)] 
render: tiled: Export draw-tile-map*.

* chickadee/render/tiled.scm: Export draw-tile-map*.

15 months agorender: tiled: Invert Y coordinates of objects.
David Thompson [Mon, 30 Apr 2018 00:56:31 +0000 (20:56 -0400)] 
render: tiled: Invert Y coordinates of objects.

* chickadee/render/tiled.scm (load-tile-map): Invert Y coordinate for
objects.

15 months agorender: tiled: Add tile-map-layer-ref.
David Thompson [Mon, 30 Apr 2018 00:56:05 +0000 (20:56 -0400)] 
render: tiled: Add tile-map-layer-ref.

* chickadee/render/tiled.scm (tile-map-layer-ref): New procedure.

15 months agorender: font: Fix bug in font-line-width.
David Thompson [Fri, 27 Apr 2018 12:26:17 +0000 (08:26 -0400)] 
render: font: Fix bug in font-line-width.

* chickadee/render/font.scm (font-line-width): Fix addition of number
with vector, use X coordinate instead.

15 months agoInvert Y coordinate in mouse motion event.
David Thompson [Sun, 22 Apr 2018 00:08:26 +0000 (20:08 -0400)] 
Invert Y coordinate in mouse motion event.

Reported-By: Christopher Howard <christopher.howard@qlfiles.net>
* chickadee.scm (run-game): Invert the Y coordinate received from
SDL's mouse motion event.

15 months agorender: font: Add font-line-width procedure.
David Thompson [Sun, 22 Apr 2018 00:07:38 +0000 (20:07 -0400)] 
render: font: Add font-line-width procedure.

* chickadee/render/font.scm (font-line-width): New procedure.

15 months agorender: font: Print "?" instead of crashing when character is missing.
David Thompson [Sun, 22 Apr 2018 00:06:10 +0000 (20:06 -0400)] 
render: font: Print "?" instead of crashing when character is missing.

* chickadee/render/font.scm (draw-text*): Default to "?" character
when the desired character isn't present in the font.

17 months agoUpdate .dir-locals.el.
David Thompson [Wed, 14 Mar 2018 00:42:40 +0000 (20:42 -0400)] 
Update .dir-locals.el.

18 months agoAdd tile map example.
David Thompson [Tue, 30 Jan 2018 00:16:19 +0000 (19:16 -0500)] 
Add tile map example.

* examples/images/tiles.png: New file.
* examples/map/example.tmx: New file.
* examples/tiled.scm: New file.
* Makefile.am (EXTRA_DIST): Add them.
* examples/images/AUTHORS: Credit the author of the tileset.

18 months agorender: Add Tiled map renderer.
David Thompson [Sun, 28 Jan 2018 15:34:14 +0000 (10:34 -0500)] 
render: Add Tiled map renderer.

* chickadee/render/tiled.scm: New file.
* Makefile.am (SOURCES): Add it.
* doc/api.texi (Tile Maps): New subsection.

18 months agorender: texture: Define custom record type printer for texture atlas.
David Thompson [Sun, 28 Jan 2018 15:31:32 +0000 (10:31 -0500)] 
render: texture: Define custom record type printer for texture atlas.

* chickadee/render/texture.scm (display-texture): New procedure.

18 months agoguix: Switch back to Guile 2.2.2.
David Thompson [Sun, 28 Jan 2018 15:40:32 +0000 (10:40 -0500)] 
guix: Switch back to Guile 2.2.2.

2.2.3 has a bad performance regression. :(

18 months agowindow: Display warning when vsync is not supported.
David Thompson [Sun, 28 Jan 2018 00:53:20 +0000 (19:53 -0500)] 
window: Display warning when vsync is not supported.

A lot better than crashing, I'd say. :)

Reported-By: Christopher Howard <christopher.howard@qlfiles.net>
* chickadee/window.scm (open-window): Catch errors thrown by
set-gl-swap-interval! and emit warning.

18 months agomath: matrix: Fix typos in matrix4-2d-transform!
David Thompson [Wed, 17 Jan 2018 19:43:31 +0000 (14:43 -0500)] 
math: matrix: Fix typos in matrix4-2d-transform!

* chickadee/math/matrix.scm (matrix4-2d-transform!): Fix bad typos!

18 months agorender: texture: Keep a rect for use with draw-sprite and friends.
David Thompson [Wed, 17 Jan 2018 19:20:14 +0000 (14:20 -0500)] 
render: texture: Keep a rect for use with draw-sprite and friends.

Easier to calculate it once and hang onto it than to generate it each
time draw-sprite is called.

* chickadee/render/texture.scm (<texture>)[rect]: Delete field.
[x y width height gl-tex-rect]: New fields.
* chickadee/render/sprite.scm (draw-sprite*, draw-sprite,
draw-nine-patch*): Use proper accessors for texture rects.

18 months agorender: font: Fix typo.
David Thompson [Wed, 17 Jan 2018 19:18:14 +0000 (14:18 -0500)] 
render: font: Fix typo.

* chickadee/render/font.scm (%null-vec): Rename to...
(%null-vec2): ...this.

18 months agorender: sprite: Fix bug in rendering texture regions.
David Thompson [Wed, 17 Jan 2018 18:33:10 +0000 (13:33 -0500)] 
render: sprite: Fix bug in rendering texture regions.

The texture-rect procedure contains the pixel location of the texture
region, so if you use that rect to render a sprite the result is a
sprite offset by its location in the greater texture, which is very
very very wrong.

* chickadee/render/sprite.scm (draw-sprite): Dynamically configure
rendering rect based on the texture region's width and height.

18 months agorender: texture: Fix split-texture.
David Thompson [Wed, 17 Jan 2018 18:32:00 +0000 (13:32 -0500)] 
render: texture: Fix split-texture.

* chickadee/render/texture.scm (split-texture): Width and height
variables need to contain exact numbers.

18 months agoRevert "Add error handling to game loop."
David Thompson [Wed, 17 Jan 2018 17:10:38 +0000 (12:10 -0500)] 
Revert "Add error handling to game loop."

This reverts commit 8cbb7eed56c4b5edd780c2d51aaa0a4c3eab7350.

18 months agorender: Refactor sprite rendering.
David Thompson [Wed, 17 Jan 2018 17:01:41 +0000 (12:01 -0500)] 
render: Refactor sprite rendering.

* chickadee/render/texture.scm (<texture-region>): Delete type.
(<texture>)[width, height, gl-size]: Delete fields.
[parent, rect, gl-rect]: Add fields.
(texture-region?): Rewrite.
(make-texture, null-texture): Use new texture constructor.
(make-texture-region): Rewrite in terms of <texture> type.
(list->texture-atlas, split-texture): Use new texture region
constructor.
* chickadee/render/sprite.scm (draw-sprite*): New procedure.
(draw-sprite): Rewrite in terms of draw-sprite*.
(draw-nine-patch*): New procedure.
(draw-nine-patch): Rewrite in terms of draw-nine-patch*.
* chickadee/render/font.scm (draw-text*): New procedure.
(draw-text): Rewrite in terms of draw-text*.
* doc/api.texi: Update draw-sprite, draw-nine-patch, and draw-text
docs.

18 months agomath: matrix: Add matrix4-2d-transform! procedure.
David Thompson [Wed, 17 Jan 2018 17:00:29 +0000 (12:00 -0500)] 
math: matrix: Add matrix4-2d-transform! procedure.

* chickadee/math/matrix.scm (matrix4-2d-transform): New procedure.

19 months agoAdd error handling to game loop.
David Thompson [Sat, 13 Jan 2018 01:42:37 +0000 (20:42 -0500)] 
Add error handling to game loop.

* chickadee.scm (error-handler): New procedure.
(with-error-handling): New syntax.
(run-game): Handle errors caught when running hooks.

19 months agoFix broken mouse Y coordinate inversion.
David Thompson [Tue, 9 Jan 2018 14:03:06 +0000 (09:03 -0500)] 
Fix broken mouse Y coordinate inversion.

* chickadee.scm (run-game): window-height is not a procedure!

19 months agoaudio: Use values between 0 and 1 for volume.
David Thompson [Tue, 9 Jan 2018 13:42:46 +0000 (08:42 -0500)] 
audio: Use values between 0 and 1 for volume.

Hide the weird SDL usage of 0 to 128.

* chickadee/audio.scm (set-sample-volume!, music-volume,
set-music-volume!): Translate to/from SDL's volume range.

19 months agorender: shapes: Add draw-filled-rect procedure.
David Thompson [Tue, 9 Jan 2018 02:46:21 +0000 (21:46 -0500)] 
render: shapes: Add draw-filled-rect procedure.

* chickadee/render/shapes.scm (draw-filled-rect): New procedure.

19 months agorender: color: Add color-lerp procedure.
David Thompson [Tue, 9 Jan 2018 02:45:16 +0000 (21:45 -0500)] 
render: color: Add color-lerp procedure.

* chickadee/render/color.scm (color-lerp): New procedure.

19 months agorender: sprite: Allow passing custom transformation matrices.
David Thompson [Fri, 5 Jan 2018 20:56:26 +0000 (15:56 -0500)] 
render: sprite: Allow passing custom transformation matrices.

* chickadee/render/sprite.scm (draw-sprite-unbatched,
draw-sprite-batched): Replace 'scale' and 'rotation' arguments with a
'matrix' argument.
(sprite-batch-add!): Ditto. Also, correctly transform sprite
vertices.  This was previously not handling rotations properly.
(%default-offset): New variable.
(draw-sprite, draw-nine-patch): Change default values for 'rotation'
and 'scale'.  Add 'matrix' and 'offset' arguments.
* chickadee/render/font.scm (%default-offset): New variable.
(draw-text): Change default values for 'rotation' and 'scale'.  Add
'offset' and 'matrix' arguments.

19 months agoFix inverted Y coordinates in mouse events.
David Thompson [Fri, 5 Jan 2018 19:57:15 +0000 (14:57 -0500)] 
Fix inverted Y coordinates in mouse events.

* chickadee.scm (run-game): Invert all Y coordinates received from SDL.

19 months agomath: matrix: Allow translation by rect as if it were a vector.
David Thompson [Fri, 5 Jan 2018 19:49:27 +0000 (14:49 -0500)] 
math: matrix: Allow translation by rect as if it were a vector.

* chickadee/math/matrix.scm (matrix4-translate!): Add rect support.

19 months agoguix: Use Guile 2.2.3.
David Thompson [Fri, 5 Jan 2018 19:48:57 +0000 (14:48 -0500)] 
guix: Use Guile 2.2.3.

21 months agowindow: Remove problematic GL attribute.
David Thompson [Wed, 15 Nov 2017 02:44:48 +0000 (21:44 -0500)] 
window: Remove problematic GL attribute.

I found that the 'framebuffer-srgb-capable' setting does not work with
Mesa 17.2.1.  Best to just get rid of it.

* chickadee/window.scm (open-window): Remove setting for
'framebuffer-srgb-capable'.

21 months agomath: matrix: Allow translation with 3D vectors.
David Thompson [Mon, 13 Nov 2017 02:48:15 +0000 (21:48 -0500)] 
math: matrix: Allow translation with 3D vectors.

* chickadee/math/matrix.scm (matrix4-translate!): Add support for
the vec3 type.

21 months agomath: vector: Export vec3-z.
David Thompson [Mon, 13 Nov 2017 02:47:52 +0000 (21:47 -0500)] 
math: vector: Export vec3-z.

21 months agomath: quaternion: Add custom record type printer.
David Thompson [Mon, 13 Nov 2017 02:41:10 +0000 (21:41 -0500)] 
math: quaternion: Add custom record type printer.

* chickadee/math/quaternion.scm (display-quaternion): New procedure.

21 months agomath: quaternion: Stop referncing inline procedure before it's defined.
David Thompson [Mon, 13 Nov 2017 02:37:48 +0000 (21:37 -0500)] 
math: quaternion: Stop referncing inline procedure before it's defined.

* chickadee/math/quaternion.scm (with-new-quaternion): Build
  quaternion manually instead of using make-null-quaternion.

21 months agomath: matrix: Support converting a quaternion into a rotation matrix.
David Thompson [Mon, 13 Nov 2017 02:21:50 +0000 (21:21 -0500)] 
math: matrix: Support converting a quaternion into a rotation matrix.

* chickadee/math/matrix.scm (matrix4-rotate!, matrix4-rotate): New
  procedures.

21 months agorender: font: Add support for .fnt formatted fonts.
David Thompson [Sat, 11 Nov 2017 21:02:37 +0000 (16:02 -0500)] 
render: font: Add support for .fnt formatted fonts.

* chickadee/render/font.scm (load-font): Check for .xml and .fnt file
extensions and DTRT.
(parse-fnt, parse-bmfont-sxml): New procedure.

21 months agoguix: Update to latest guile-sdl2 commit.
David Thompson [Sat, 11 Nov 2017 04:19:14 +0000 (23:19 -0500)] 
guix: Update to latest guile-sdl2 commit.

21 months agorender: font: Add support for tile fonts.
David Thompson [Sat, 11 Nov 2017 04:17:36 +0000 (23:17 -0500)] 
render: font: Add support for tile fonts.

* chickadee/render/font.scm (load-tile-font): New procedure.

21 months agorender: font: Simplify implementation with texture regions.
David Thompson [Sat, 11 Nov 2017 04:15:07 +0000 (23:15 -0500)] 
render: font: Simplify implementation with texture regions.

* chickadee/render/font.scm (<font-char>) [texture, region]: Remove.
[texture-region]: New field.
(load-font): Use texture regions.
(draw-text): Render using texture regions.

21 months agodoc: scripting: Replace references to "wait" with "sleep".
David Thompson [Fri, 27 Oct 2017 16:07:09 +0000 (12:07 -0400)] 
doc: scripting: Replace references to "wait" with "sleep".

21 months agoscripting: agenda: Add reset-agenda procedure.
David Thompson [Thu, 19 Oct 2017 15:33:57 +0000 (11:33 -0400)] 
scripting: agenda: Add reset-agenda procedure.

* chickadee/scripting/agenda.scm (reset-agenda): New procedure.

21 months agorender: texture: Fix bug in texture region coordinate calculation.
David Thompson [Wed, 18 Oct 2017 03:05:58 +0000 (23:05 -0400)] 
render: texture: Fix bug in texture region coordinate calculation.

* chickadee/render/texture.scm (make-texture-region): Fix broken
  texcoord width/height calculation.

21 months agoThird time's the charm for a bug fix?
David Thompson [Wed, 18 Oct 2017 02:42:26 +0000 (22:42 -0400)] 
Third time's the charm for a bug fix?

22 months agoFix build bug for real this time.
David Thompson [Wed, 18 Oct 2017 02:34:33 +0000 (22:34 -0400)] 
Fix build bug for real this time.

22 months agorender: texture: Fix strange parallel compilation issue.
David Thompson [Wed, 18 Oct 2017 02:14:14 +0000 (22:14 -0400)] 
render: texture: Fix strange parallel compilation issue.

I have no damn clue why #:select causes this problem, but simply not
using it fixes things!

22 months agoAdd generalized A* path finding algorithm.
David Thompson [Wed, 18 Oct 2017 02:05:47 +0000 (22:05 -0400)] 
Add generalized A* path finding algorithm.

* chickadee/path-finding.scm: New file.
* Makefile.am (SOURCES): Add it.

22 months agorender: sprite: Add support for drawing texture regions.
David Thompson [Wed, 18 Oct 2017 01:44:31 +0000 (21:44 -0400)] 
render: sprite: Add support for drawing texture regions.

* chickadee/render/sprite.scm (%default-texture-region): Rename to...
(%default-texcoords): ...this.
(draw-sprite): Replace #:texture-region arg with #:texcoords.  Add
support for texture regions.  Update docstring.
(draw-nine-patch): Add support for texture regions.
* chickadee/render/font.scm (draw-text): Change #:texture-region to
 #:texcoords in draw-sprite call.