Keyboard
From StoneHome
Nintendo DS Screen Keyboards
This is the keyboard graphic I use for the Nintendo DS. (The old one is here.)
The keyboard is cut into four pieces: the top half is unpressed keys and the bottom half is pressed keys; the top half of each is shifted and the lower half is unshifted. The top keyboard is 8-bit, using 128 colors to achieve a good SPAA edge. The image here is actually 256 colors, but when you reduce the image to 15-bit, roughly half of them disappear. The data presented below reflects only 128 colors, which spills over into 9 palettes because of the transparent index. In fact, many colors are still repeated, and this could be reduced further in palette size if need be; I just haven't bothered. The bottom keyboard is 4-bit, using 15 colors. The top keyboard looks somewhat better on LCDs, even though the difference is negligable on CRTs. Use the bottom one only if you can't afford extended palette mode; the difference is pretty big.
These backgrounds are correctly sized for keys to be a multiple of two blocks high by any width, and therefore can be used on tiled backgrounds. Therefore, the tiled background hardware can be used for very fast graphic updates. It's quite pleasant.
Please note that these keyboards are designed for the pixel order of the bottom screen on the DS; the order is BGR on the bottom screen but RGB on the top screen. I haven't bothered to make a top screen version, because um, you can't touch the top screen. Huhu.
I do actually have several other layouts, which I'll end up releasing once I get off of my fat lazy butt. That could of course be a very very long time away. Who knows. Still, I have a math layout, a special symbol for chat layout, some special english layouts (two different ways of mapping both capitals and lower case at the same time,) and so on.
Screen Keyboard Code
I'll release this Real Soon Now™. There are some things I want to clean up first. One nice thing about the code I wrote is that it works with arbitrary key layouts of key sizes in width multiples of 8x16 blocks; therefore, most alternate language keyboards and many specialty keyboards can also be implemented trivially easily. It's fairly lame, admittedly, but at the same time, it's moderately wootastic. Similarly, since it just operates on tile data, you can also replace the image data with your own, if you like.
This may be useful in conjunction with the streambuffer example code and/or the GBA Extended ASCII System.
Metrics
The keyboards are full 256px screen width (32 tiles) by partial 80 px height (10 tiles, or 41.6% screen height.) Used on a screen, it looks moderately sized; it is wider than, but roughly as tall as, the PictoChat keyboard. More space is left over than in pictochat due to other interface padding.
Most keys are 16x16. All keys are 16px high. Tab and alt are 32px wide. Control, capslock, return, backspace and menu are 40px wide. Shift is 48px wide. The spacebar is 96px wide. Because many tiles are repeated (particularly top edges, the spacebar and the blank squares,) the actual keyboard image data is only 873 tiles for all four keyboard versions together instead of 1280 as one might expect.



