I’ve been working on some native (Non-Carbon) video code for SDL
for about the past 2 month, and I finally have something to show off.
Just briefly, I’d like to outline what I have done (more info later if
there are questions), then you should download some of the stuff listed
below if you want to check it out.
I have coded the majority of the internal video functions that
hold up SDL’s video and event subsystems. The implementation is
Cocoa-based; the source files are compiled by the Objective-C compiler,
but on casual glance they look like normal C code (one of the beauties
of ObjC IMHO). By Cocoa-based, I mean that the window is of the NSWindow
variety, and the event loop is of the NSApplication variety. There is
still some Carbon code here, for functions that are not yet in Cocoa (or
may never be, keep your fingers crossed). The Cursor code could be
ported to Cocoa using the NSCursor class. Other things like
HideMenuBar() seem to have no Cocoa equivalents.
The drawing surface is set up either as a direct pointer to VRAM in
the fullscreen case, or a pointer to a QuickDraw port in the windowed
case. I have made a point of optimizing the in -a-window drawing to
avoid the triple-buffer dilemma in the current Carbon video code, so you
may notice some increased fps in your apps. Currently, there is no
support for blit acceleration, although hardware palette and gamma
functions are available. There are some artefacts in fullscreen mode
that I hope to get cleared up by submitting a bug report to Apple.
Oh, and OpenGL works, except for fullscreen using the Software
The event loop has support for (real) 3-button mice, and scroll
wheel, which might interest some of you. There is still 3-button mouse
emulation for those unfortunate single-button mouse users.
The sound support is still using CarbonSound (SoundManager API). I
have added locks to the callback to better support the LockAudio() api.
There is currently no joystick support coded yet. The HID Manager,
part of IOKit that handles HID-class USB devices, has not been
documented until recently (today?) and sample code will follow soon that
will help speed things along once they get started (I will try if I have
the free time).
There is also no CDROM support coded yet. In Mac OS X, Audio CD's
mount as a directory containing .aiff files, so we will require some
trickery to simulate a true CDRom device.
As a last note, I am building everything using the Framework shared
library model in Project Builder, which is not very intuitive to the
standard UNIX shared library model that many of you already know. I’ve
tried to explain it in the README included with the SDL Project Builder
Projects. Additionally, you can read more about Frameworks here
(Generalized to Bundles, which is what a Framework really is):
In this directory you will find lots of goodies (I will add more
later, maybe right after I write this).
Here is what is there now:
SDL.tar.gz - Current CVS augmented by my new code. Will someone create
SMPEGPBProject.tar.gz - Project Builder files for SMPEG.
SDLMixerPBProject.tar.gz - Project Builder files for SDLMixer
CircusLinux.tar.gz - Source and Project for the game.
Maelstrom.tar.gz - Same for Maelstrom GPL.