[ab] initialization of the sdl* libraries
Luke Crook
luke at balooga.com
Sat Dec 30 03:44:02 CST 2006
Justin discovered a bug in sdl_mixer that causes everything to crash when the
mixer is initialized/uninitialized more than once in a Lisp session. So I've
had to make some modifications to WITH-INIT to compensate for this.
I have added three functions, INITIALIZE-ON-STARTUP, QUIT-ON-EXIT and SDL-QUIT-
ON-EXIT.
(setf sdl::SDL-QUIT-ON-EXIT t) will cause SDL-QUIT to be called when WITH-INIT
ends.
(setf sdl::SDL-QUIT-ON-EXIT nil) will not call SDL-QUIT when WITH-INIT ends.
(sdl::INITIALIZE-ON-STARTUP sdl-cffi::sdl-init-video sdl-cffi::sdl-init-audio
...etc), lists the sub-systems of SDL that must be initialized by WITH-INIT,
if not already initialized.
(sdl::QUIT-ON-EXIT sdl-cffi::sdl-init-video ...etc), lists the sub-systems of
SDL that must be uninitialized by WITH-INIT, if not already uninitialized.
So if you want SDL to initialize video, audio, and the cdrom when starting but
to only uninitialize the video when exiting then do the following:
(sdl::initialize-on-startup sdl-cffi::sdl-init-video
sdl-cffi::sdl-init-audio
sdl-cffi::sdl-init-cdrom)
(sdl::quit-on-exit sdl-cffi::sdl-init-video)
(sdl::sdl-quit-on-exit nil)
(sdl::WITH-INIT ()
...
)
All of this is in lispbuilder-sdl/sdl/init.lisp
- Luke
More information about the application-builder
mailing list