2008-05-23

Woopsi Examples

New examples in the “examples” folder! They are:

WPaint

I wanted to make a DPaint clone, but as I’m too busy making Woopsi itself, I’ve settled for this. Put together in about an hour, in ~300 lines of code, here’s WPaint:

WPaint

WPaint

The buttons from A to J select drawing tools. The coloured buttons choose a new drawing colour. The demo consists of a screen, a couple of windows, a dozen or so buttons and a SuperBitmap.

Whilst putting this together, I noticed that the line routine was useless (it couldn’t cope with vertical lines or lines with a negative gradient in the x axis) so I’ve replaced it with a function that works. I also noticed that the floodFill() method was overflowing the DS’ stack and had trouble with areas above the initial stylus click. Both problems are now fixed.

EDIT: And there were some problems with data sizes in the floodFill() routine and its associated stack routines, and the SuperBitmap::drawHorizLine() method crashed if it tried to draw a line 1 pixel wide. Those are fixed too.

Dimmed Screen Demo

This is a test of the DimmedScreen class:

DimmedScreenDemo

DimmedScreen

The DimmedScreen class now has a destructor.

File Requester Demo

A test of the FileRequester class:

FileRequesterDemo

FileRequester

There was a bug in the FileRequester’s constructor that would cause a real DS to crash (dereferencing a NULL pointer; DeSmuME happily continued running, as it still has very unhelpful memory handling). This is now fixed.

All of the sourcecode for these demos is available from the SVN repository.

There are a couple of other new changes. All gadgets now have protected copy constructors, as per Jeff’s advice. Also, the makefiles for the examples no longer require PALib or fall over if they can’t find a Woopsi library folder in the devkitPro directory.

Incidentally, the “Hello World” example ROM now weighs in at 149K, which is nearly 100K less than its size at the start of April.