Common Lisp FFI for the Allegro Games Library

cl-alleg provides a foreign function interface for the Allegro games library. This is built on top of CFFI and so should be portable across multiple common lisp implementations. Development is currently on CLISP under Win32 but in theory it should work under Linux or MacOS. I'm learning lisp as I go with this project, so any comments are very welcome!

Development is currently driven by the requirements of writing a simple Allegro-based game. There's a blog discussing this.

Here's the Allegro Hello World program in Lisp:

(defun allegro-hello-world ()
  (with-allegro
      (progn
        (install-keyboard)
        
        (when (set-gfx-mode *gfx-autodetect-windowed* 320 200 0 0)
          (set-gfx-mode *gfx-text* 0 0 0 0)
          (error "Unable to set graphics mode"))
                
        (clear-to-color *screen* (make-col 255 255 255))
        
        (with-acquire-screen
            (textout-centre-ex *screen* 
                               *font* 
                               "Hello, world!" 
                               (/ (screen-w) 2) 
                               (/ (screen-h) 2)
                               (make-col 0 0 0)
                               -1))
        
        (readkey))))

You can download the current version using anonymous CVS.

Links

SourceForge.net Logo