–snip–On 8/20/05, Sam Lantinga wrote:
I’ve been working on a port of SDL to iPodLinux
(http://www.ipodlinux.org). I’ve created a patch for both the
standard 2-bit iPod screen (using an unchangeable palette) and the
16-bit iPod photo. The patch is attached, against version 1.2.8.
Very cool! Could you create a README.iPodLinux to go along with it?
iPod Patch for Simple DirectMedia Layer
Author: Joshua Oreman <@Joshua_Oreman>
This is a patch against SDL 1.2.8 for the iPod framebuffer, both
black-and-white and color. It has been tested with a black-and-white
iPod, since that’s all I have. Anyone with an iPod photo or color,
feel free to test it and report any bugs to me.
In order to build this library for the iPod, you’ll need the arm-elf toolchain.
If you checked out the SDL source from CVS, run
to update all build files.
To build SDL for iPod:
% ./configure CFLAGS="-D__unix__" --host=arm-elf LDFLAGS=-Wl,-elf2flt
–disable-joystick --disable-cdrom --disable-video-opengl
Copy the library at src/.libs/libSDL.a somewhere easily accessible.
Link against it by specifying its path as an argument to the linker,
or copy it to /usr/local/arm-elf/lib and use -lSDL.
BPP. On monochrome iPods, call SDL_SetVideoMode() with bpp as 8.
(Not 2!) You can use SDL_ListModes() as normal to determine what kind
of iPod you’re running on.
2-Bit Palette. For various reasons, 2-bit color is represented as an
unchangeable 8-bit palette with =white, =light grey, =dark
grey, =black, =white, … . If you want to apply this palette
to surfaces you create, you should know that light grey is RGB
160/160/160 and dark grey is RGB 80/80/80.
The mouse will be shown, though there’s not much you can do with it,
so you probably want to SDL_HideMouse().
Events. You’ll only ever receive SDL_KEYUP and SDL_KEYDOWN events. They are:
SDLK_r = scroll right
SDLK_l = scroll left
SDLK_m = Menu
SDLK_w = Rewind/Previous
SDLK_f = FFwd/Next
SDLK_d = Play/Pause
Scroll events are 96 to a rotation.
Much more information is available at
http://www.ipodlinux.org/SDL_Programming, including some sample code.
Is there a possibility of this patch getting into 1.2.9?