2007-07-30

TextViewerDS

The first part of AmigaGuideDS is done - I’ve got a text viewer class that will display as much text as you give it, and scroll it smoothly over both of the DS’ screens. The d-pad and stylus both scroll the text.

Adding stylus support was tricky. In the last set of changes, I’d amended the text viewer so that it would re-draw just the last line of text (if scrolling upwards) or the first line of text (if scrolling downwards). As the d-pad only scrolls the screen at a few pixels per frame this worked fine. The stylus can scroll the entire screen in one frame, though, if swiped fast enough, which means that just re-drawing the bottom/top line of text is no use - a whole new screen of text will have scrolled into view and need to be drawn.

After much fiddling, though, it now all works. Any new lines of text that appear during a scroll now get drawn to the screen, and any other lines of text are moved around simply by copying the memory around using DMA_Copy().

I’ve amended the text wrapping function so that it now respects line returns, and added DLDI support so that the text is loaded as a file from the flash cart. I’ve also replaced the font I was using (the standard PALib black-and-white font) with the Amiga’s “Topaz” font for that authentic 1992 feel.

Adding DLDI support was easy enough. It required one change to the makefile I use: line 58 needs to be changed from “LIBS := -lnds9” to “LIBS := -lfat -lnds9”. In order to add the FAT library to VC++’s IntelliSense:

  • Select “Project/ Properties…” from VC++’s menu bar;
  • Select “Configuration Properties/NMake” in the tree menu of the PropertyPages window;
  • Add ;“$(DKP_HOME)\libnds\include” into the “Include Search Path” box (include the semi-colon and quotes);
  • Click OK.

That adds all of the libnds include files into IntelliSense.

In addition to all of this, DeSmuME now works in my Parallels install again. I’d forgotten to upgrade the drivers after installing the latest upgrade.

Here’s the least-exciting screenshot you’re likely to see (binary and source releases coming as soon as I’ve tidied them up):

TextViewerDS