guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ANN] FFI bindings for SDL2


From: David Thompson
Subject: [ANN] FFI bindings for SDL2
Date: Tue, 06 Oct 2015 23:05:33 -0400
User-agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu)

Hello Guilers,

SDL is a handy library for taking care of low-level window management
and keyboard/mouse input for video games.  Version 2 was released quite
some time ago, but guile-sdl only works with SDL 1.x because SDL2 is
essentially an entirely different library.  Furthermore, guile-sdl is
written in C and uses a complicated build system, making it hard to
hack.  It also fails to build on OS X.  So, I have begun the guile-sdl2
project to create pure Scheme bindings for SDL2.  I plan to use this
library for Sly when all the needed functions have been wrapped.

So far I've only wrapped a handful of functions, but the autotools build
system is in place to make it easy for others to build and contribute
patches.  Still need to set up the Texinfo manual, though.  For Guix
users, there is a 'guix.scm' file that can be used with 'guix
environment', 'guix build', and/or 'guix package'.

There are lots of functions to wrap, so I would love some help if anyone
else out there is interested in SDL2!  Patches are very much welcome.

Currently, the only thing you can really do is open and manipulate
windows, like so:

    (use-modules (sdl2) (sdl2 video))
    
    (sdl-init)
    
    (define window
      (make-sdl-window #:size '(800 600)
                       #:title "Hello, Guilers!"
                       #:opengl? #t))
    
    (set-sdl-window-title! window "Goodbye, Guilers!)
    
    (close-sdl-window! window)

The Git repository can be browsed on-line:

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

And here's how to clone the repo:

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

Happy hacking!

-- 
David Thompson
GPG Key: 0FF1D807



reply via email to

[Prev in Thread] Current Thread [Next in Thread]