As my Google Summer of Code project, I am porting SDL to iPhone and
iPod Touch. For the first few weeks of the project I was finishing up
school, but now I’m coding full force. It’s been one month since GSoC
started, and so without further adieu, here is my month 1 progress
Here is what is working:
SDL_main: it was necessary to execute a custom main, and then return
control to the user’s main function. On Mac OS X, this isn’t
necessary, but it turns out it is on iPhone (I can’t go into why).
SDL_mouse: Touch events are emulated as one-click mice. Multi-touch
is registered by presenting each touch as a different mouse.
SDL_video: Added a UIKit based video driver. iPhone applications must
be single-window full-screen, so this is all I support. You do have
the option, however, through the SDL_WINDOW_BORDERLESS to hide the
status bar (which normally shows the time, battery status, network
Most significantly, I modified the OpenGL based render driver to
create an OpenGL ES v1.1 based render driver. This render driver
could be re-used to port SDL to other platforms with OpenGL ES
support. This render driver is now complete, though is lacks all the
pixel format support of its OpenGL counter-part. The OpenGL ES render
driver does not support indexed formats (since OpenGL ES does not even
have an extension for these formats) and doesn’t support BGR formats
(since OpenGL ES only supports RGB(A) formats and will not re-order
the data for you).
Here is what is NOT presently up and running:
SDL_audio: I am addressing this topic next!
SDL_keyboard: I’m not sure what I’m going to do for keyboard support.
They only good way I can think of doing it is by adding a separate API
for additional iPhone support. The main problem is that I need calls
for showing and hiding the keyboard.
SDL_compat: I have not taken a thorough look at this yet. I figured
it would be better to approach the project by making the SDL 1.3 calls
work first, and then worry about the compatibility layer. All my test
programs have been written without using these deprecated functions.
SDL_rwops: iPhone applications are only technically allowed to write
data in special designated areas. I need to ensure that’s what happens.
Other notes: it was really easy to get SDL_image working on iPhone.
I’ll look at SDL_mixer once I’m done with the rudimentary audio
support in SDL_audio. I really wish I could get SDL_ttf up and
running, but I’m not sure that’s possible since the freetype library
isn’t present (any ideas?).
As I posted before, there is a video up on youtube which shows three
of my SDL demos running on iPhone:
I will likely post more videos soon.
Finally, I unfortunately still can’t post my source to the repository
because the iPhone SDK is still under NDA. This should change early
thanks for reading, and any input is welcome!
- Holmes Futrell