2008-10-05

Timers Revisited

Following on from yesterday’s post, I’ve removed the existing VBL timing system and replaced it with a WoopsiTimer class. So, instead of adding your gadgets to the woopsiApplication’s VBL listener vector, you now create an instance of the WoopsiTimer class and handle its EVENT_ACTION event. The change has resulted in the removal of some nasty, counterintuitive code and cruft, and made VBL timing easier to work with. There’s a new “timer” example in the examples folder.

I’ve fiddled with a number of other things, too. The TinyFont bitmap now has all of the missing glyphs in place, and I’ve moved the at symbol to the correct location. Haven’t made the .c file yet, though.

SkinnedWindows move to the front when they are clicked. Not sure when I broke that.

All references to text position in any classes involved with text have been renamed to alignment. For example, TextBox::setTextPositionVert() is now TextBox::setTextAlignmentVert(), and TEXT_POSITION_VERT_CENTRE is now TEXT_ALIGNMENT_VERT_CENTRE. “Position” didn’t quite cut it. Similarly, all methods called “addText()” that were really appending text are now called “appendText()”.

I’ve made a few other changes and fixes to the TextBox, but the most significant is the addition of the concept of a cursor. This can be positioned anywhere within the string that the TextBox contains, and the new “insertTextAtCursor()” function allows text to be inserted at that location. The cursor isn’t drawn yet, as it’s a bit tricky. A rectangular XOR box the size and width of the character at the cursor position is probably the easiest option.

As soon as I get that done I think it’s about time for another release. I’d planned to release a new version on the 11th of this month, as that was (so I thought) the day when I first started Woopsi development. However, it appears I’ve been working on this for over a year; the first post about it on this blog was on September 9th last year. Nuts, a milestone missed.