summaryrefslogtreecommitdiff
path: root/chickadee.scm
Commit message (Collapse)AuthorAgeFilesLines
* Add mouse wheel event handler.David Thompson2021-05-131-0/+4
|
* graphics: Rewrite with-graphics-state to use state specs.David Thompson2021-03-141-1/+1
| | | | | | | | | | | | | | | | Treating the names inside the let-like form as just symbols caused numerous bugs where a program would crash because it was trying to set graphics state that was never defined due to the relevant module never being imported. By changing with-graphics-state to require passing in the <graphics-state-spec> object, much like how parameterize works with parameter objects, it completely eliminates this type of bug. If the module containing the spec variable isn't imported, there will be an undefined variable error thrown early on. Additionally, graphics state objects needed to have a stack added to them to track previous values so that with-graphics-state could restore them later. The old trick of using let to stash the previous values no longer worked with the new macro implementation.
* Add support for window resizing.David Thompson2021-03-051-11/+20
|
* graphics: Rewrite rendering engine.David Thompson2021-01-261-13/+8
|
* graphics: gpu: Move guardian to <gpu> structure.David Thompson2021-01-201-1/+1
|
* Switch to high resolution timer.David Thompson2020-12-151-4/+5
|
* Update to new guile-sdl2 API.David Thompson2020-12-051-10/+10
|
* Fallback to no multisampling if window creation fails.David Thompson2020-11-181-19/+45
|
* Add elapsed-time procedure.David Thompson2020-11-161-0/+6
|
* Remove scancode argument from key-press and key-release handlers.David Thompson2020-11-161-2/+0
|
* graphics: Add multisampling support.David Thompson2020-10-121-0/+4
|
* Rename 'render' subdirectory to 'graphics'.David Thompson2020-10-031-5/+5
|
* render: gpu: Query GL context for GL and GLSL versions.David Thompson2020-08-241-0/+6
|
* Resize default viewport when window is resized.David Thompson2020-08-241-1/+6
| | | | | Thanks to Peter Elliott <pelliott@ualberta.ca> for the original version of this patch.
* render: viewport: Decouple screen clearing from viewport switching.David Thompson2020-04-111-3/+1
| | | | | This makes it possible to a apply a viewport multiple times in a frame without clearing each time and wiping out part of your work.
* Add controller-button-released? procedure.David Thompson2020-04-081-0/+5
|
* Integrate new audio module into game loop.David Thompson2020-04-071-3/+6
| | | | * chickadee.scm (run-game): Replace SDL mixer with OpenAL audio system.
* Clear the screen even when nothing is being drawn.David Thompson2019-11-061-5/+10
|
* Add a bunch of window manipulation procedures.David Thompson2019-11-061-19/+108
|
* render: Collect all managed GPU state into a single record type.David Thompson2019-11-061-2/+4
|
* Remove obsolete controller handling code.David Thompson2019-01-091-6/+0
| | | | | * chickadee.scm (run-game): Remove initial iteration over game controller hash table.
* Add SDL2 game controller database file.David Thompson2019-01-081-0/+3
| | | | | | | | | This will allow for lots of controllers to be automatically mapped correctly without the user having to do anything. * data/gamecontrollerdb.txt: New file. * Makefile.am (dist_pkgdata_DATA): Add it. * chickadee.scm (run-game): Load game controller db file.
* Remove redundant open-all-controllers procedure.David Thompson2019-01-061-8/+0
| | | | | | | | | I thought this was necessary to process controllers that were already connected to the computer before a Chickadee-using program was launched, but that doesn't seem to be the case. * chickadee.scm (open-all-controllers): Delete. (run-game): Remove call to open-all-controllers.
* Add controller-name procedure.David Thompson2019-01-061-0/+9
| | | | * chickadee.scm (controller-name): New procedure.
* Fix normalization of game controller axis values.David Thompson2019-01-061-3/+2
| | | | | * chickadee.scm (controller-axis): Fix math so that axis values are actually in the range [0, 1].
* Fix game controller stuff.David Thompson2018-12-141-5/+5
| | | | | Forgot to prefix imported procedures since I define procedures with the same names.
* Add controller query procedures.David Thompson2018-12-141-4/+18
| | | | | | | Not ready to document them at this time since I have not done full tests with a USB controller yet. * chickadee.scm (controller-button-pressed?, controller-axis): New procedures.
* Add mouse query procedures.David Thompson2018-12-131-2/+23
| | | | | * chickadee.scm (mouse-x, mouse-y, mouse-button-pressed?, mouse-button-released?): New procedures.
* Re-add key-pressed? and key-released? procedures.David Thompson2018-12-131-1/+12
| | | | | * chickadee.scm (key-pressed?, key-released?): New procedures. * examples/grid.scm: Remove (sdl2 input keyboard) import.
* Re-hide SDL2 details.David Thompson2018-12-131-73/+183
| | | | | | | | | | | | | | | | | | | | | I know I'm backpedaling here, but I think it was a mistake to expose SDL2 as much as I have here. I think it's better for people just getting started to not have to wonder what SDL means. Making things as usable as possible for beginners is an important goal, and abstracting SDL2 + OpenGL things from the core game loop implementation shouldn't require sacrificing that goal. * chickadee.scm: Switch code with... * chickadee/game-loop.scm: ...this! Which is copied straight from... * chickadee/sdl.scm: ...this! Which is now deleted. * Makefile.am (SOURCES): Add game-loop.scm, remove sdl.scm. * examples/grid.scm: Update due to API breakage. * examples/lines.scm: Ditto. * examples/nine-patch.scm: Ditto. * examples/sprite.scm: Ditto. * examples/text.scm: Ditto. * examples/tiled.scm: Ditto. * doc/api.texi (Kernel): Update.
* game-loop: Sleep thread a bit to avoid 100% CPU usage.David Thompson2018-12-091-1/+3
|
* Remove default error handler.David Thompson2018-09-021-13/+15
| | | | | | | | * 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.
* Fix error handling logic.David Thompson2018-08-251-7/+15
| | | | | | | * 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.
* Remove custom backtrace display.David Thompson2018-08-251-9/+0
| | | | | Always printing a backtrace caused double backtraces to be printed when using the default error handler that just re-throws the error.
* Add default game loop error handler.David Thompson2018-08-231-4/+10
| | | | | | | * 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.
* Move SDL game loop implementation to its own module.David Thompson2018-08-231-146/+2
|
* Make the game loop modular!David Thompson2018-08-231-179/+182
| | | | | | | | | | | | | | | 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.
* Display proper backtraces when there is no game loop error handler.David Thompson2018-06-241-11/+10
| | | | | * chickadee.scm (call-with-error-handling): Do not catch errors when the error hook has nothing in it.
* error: Pass error key and args to error hook.David Thompson2018-05-031-2/+2
| | | | | * chickadee.scm (call-with-error-handling): Run hook with error key and args.
* Add game loop error hook.David Thompson2018-05-031-47/+75
| | | | | | | * 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.
* Invert Y coordinate in mouse motion event.David Thompson2018-04-211-1/+1
| | | | | | | Reported-By: Christopher Howard <christopher.howard@qlfiles.net> * chickadee.scm (run-game): Invert the Y coordinate received from SDL's mouse motion event.
* Revert "Add error handling to game loop."David Thompson2018-01-171-73/+65
| | | | This reverts commit 8cbb7eed56c4b5edd780c2d51aaa0a4c3eab7350.
* Add error handling to game loop.David Thompson2018-01-121-65/+73
| | | | | | * chickadee.scm (error-handler): New procedure. (with-error-handling): New syntax. (run-game): Handle errors caught when running hooks.
* Fix broken mouse Y coordinate inversion.David Thompson2018-01-091-1/+1
| | | | * chickadee.scm (run-game): window-height is not a procedure!
* Fix inverted Y coordinates in mouse events.David Thompson2018-01-051-3/+7
| | | | * chickadee.scm (run-game): Invert all Y coordinates received from SDL.
* Move color module into render namespace.David Thompson2017-08-081-1/+1
|
* Fix unbounded heap growth in game loop.David Thompson2017-04-251-2/+2
| | | | | * chickadee.scm (run-game): Make sure that the recursive calls to the update loop are in tail position.
* Ensure that the viewport is cleared at the beginning of each frame.David Thompson2017-01-251-0/+4
| | | | | * chickadee.scm (run-game): Switch to the null viewport at the beginning of each frame to ensure other viewports are cleared.
* Fix guile-sdl2 procedure name.David Thompson2017-01-251-1/+1
| | | | * chickadee.scm (run-game): s/keyboard-event-repeat/keyboard-event-repeat?/
* Add audio support.David Thompson2017-01-241-0/+1
| | | | | | | * chickadee/audio.scm: New file. * Makefile.am (SOURCES): Add it. * chickadee.scm (run-game): Initialize audio. * doc/api.texi ("Audio"): Document it.