2009-11-15

SDL and Woopsi2x Mark 2

Continuing the bitmap changes released in Woopsi 0.40, I’ve altered the bitmap and graphics classes so that all interaction with a bitmap’s data must occur through the bitmap class’ accessor methods. This has enabled me to change the FrameBuffer class so that it includes the SDL code that was previously floating around in the woopsifuncs files.

Instead of Woopsi mimicking the DS’ framebuffer with an intermediate array of u16s, the FrameBuffer class accesses the SDL surface directly. The FrameBuffer class still includes a u16 array, but that is used as a way of avoiding lengthy 24-bit to 16-bit conversions every time a pixel is read or written. Woopsi therefore maintains a 24-bit SDL surface and a 16-bit array and keeps them in sync by making changes to both whenever one is altered. This has resulted in a massive speed increase. Whereas the entire framebuffer simulator array was previously written to the SDL surface every VBL, only changed pixels are now written.

As a test of the new system I’ve compiled it in Xcode (no noticable change) and Code::Blocks for Windows. In the latter Woopsi is now far too fast to be usable; I probably need to put a call to SDL_Delay in there somewhere.

I’ve also compiled it for the GP2x F-200. I ported it a while ago but gave up because the GP2x’s touch screen is utterly atrocious. At the time Woopsi was too slow to be usable due to the extra copying the SDL version was performing. Now it runs at the same speed as the DS version.

woopsi2x

Here’s a pre-compiled binary and the sourcecode for Woopsi2x. Note that this is simply a test; I have no intention of maintaining a GP2x port because of the hopeless touchscreen. I’m hoping to make a Pandora port when the hardware is released.

Try it for yourself to find out just how bad the GP2x touch screen is!