Guile-SDL2

Guile-SDL2 provides Guile Scheme bindings for the SDL2 C shared library. The bindings are written in pure Scheme using Guile's foreign function interface.

Usage

Guile-SDL2 provides modules in the (sdl2 ...) namespace, roughly organized how the SDL2 C header files are organized. Low-level bindings are available in the(sdl2 bindings ...) namespace, but these are not recommended for normal usage.

Additionally, SDL2 extension library bindings are available in the following modules:

Here is a short “hello, world” example program:

(use-modules (sdl2)
             (sdl2 render)
             (sdl2 surface)
             (sdl2 video))

(define (draw ren)
  (let* ((surface (load-bmp "hello.bmp"))
         (texture (surface->texture ren surface)))
    (clear-renderer ren)
    (render-copy ren texture)
    (present-renderer ren)
    (sleep 2)))

(sdl-init)

(call-with-window (make-window)
  (lambda (window)
    (call-with-renderer (make-renderer window) draw)))

(sdl-quit)

Documentation

View the reference manual

Releases

Requirements

Installation

To install Guile-SDL2 with the GNU Guix package manager, run:

guix install guile-sdl2

To build and install Guile-SDL2 from source, run:

wget https://files.dthompson.us/guile-sdl2/guile-sdl2-0.5.0.tar.gz
tar xf guile-sdl2-0.5.0.tar.gz
cd guile-sdl2-0.5.0
./configure
make
make install

License

GNU LGPLv3+

Git Repository

Guile-SDL2 is developed using the Git version control system. The official repository is hosted at https://git.dthompson.us/guile-sdl2.git.

To clone the repository, run:

git clone https://git.dthompson.us/guile-sdl2.git

Community

Real-time discussion for Guile-SDL2 can be found on the #guile channel on the Freenode IRC network.

Contributing

Send patches and bug reports to davet@gnu.org.