Making a Keyboard

My ancient keyboard

Back to Woopsi coding. There’s not much left to do until it can go into feature-freeze and alpha status.

The easiest thing on the remaining list of things-to-do is the keyboard gadget. I actually started work on this a few months ago. It’s nothing more than a window with a few dozen buttons on it, each one representing a key on the keyboard.

I’d initially planned to follow the design of real PC keyboards, with the row offsetting that you can see in the picture above, but that doesn’t really work. The buttons need to be large so that typing text isn’t any more frustrating than it has to be. The layout needs to mimic the layout of real keyboards for the same reason, so the “[” and “]” keys need to be on the same row as the QWERTYUIOP keys. They can’t wrap around onto the next row down. This leaves me with a boring but usable grid layout (WIP grab):

Woopsi Keyboard WIP

I created this layout whilst using a PC, so it looks very odd when compared with the Mac keyboard I’m using now. Just need to add space, return and modifier keys and the layout is sorted. When it’s done, the keyboard will fire EVENT_ACTION events each time a button (ie. key) is released. The class will have a “lastKeyPressed()” function (or similar) that identifies which key caused the event.

Behind the scenes, this is called the “WoopsiKeyboard” class. For some reason the code wouldn’t compile when I called the class “Keyboard”; I imagine something in libnds has the same name.

I’ve also fixed a bug in the “packedfontbase.cpp” file. It was including “PackedFontBase.h” instead of “packedfontbase.h” (case mismatch) preventing the code from compiling in Linux. Thanks to Gattman for that one (via SourceForge).

Better get back to it, then. Not the most exciting blog post, but I’m trying to ease back into Woopsi work slowly.