Q: Overlaying keyboard on background

Post Reply
chukmunnlee
Posts: 7
Joined: Wed Aug 13, 2008 2:56 am

Q: Overlaying keyboard on background

Post by chukmunnlee » Thu Apr 16, 2009 11:14 am

HI I've been trying to display the keyboard over a bitmap background. I got the background but the graphics for the keyboard is garbled. Any pointers appreciated. Thanks

Here is the code

videoSetMode(MODE_5_2D);
vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000, VRAM_C_SUB_BG, VRAM_D_LCD);

consoleDemoInit();

bg = bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
buffer = (u16*)bgGetGfxPtr(bg);

//Create the keyboard
keyboard = keyboardInit(NULL, 2, BgType_Bmp16, BgSize_B8_512x256, 20, 0, true, true);

//Load the background on buffer
...
lcdMainOnBottom();

while (1) {
key = keysDown();
if ((key & KEY_A) {
if (keyboardDisplay->visible)
keyboardHide();
else
keyboardShow();
}
}

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: Q: Overlaying keyboard on background

Post by Sylus101 » Thu Apr 16, 2009 4:17 pm

Well, a couple of observations...

You've declared the keyboard as 16 bit, but have a mapbase of 20. That would be 20 * 16K as the mapbase offset and likely too much. I suppose you want an 8 there.

You've got a 16 bit type, but you're showing BgSize_B8_512x256, do you mean BgSize_B16_256x256 perhaps?

I ran a handful of tests and couldn't actually get a keyboard to work at all with 8bit or 16 bit backgrounds... I was able to get it to work with a 4bit text bg like in the docs example for what keyboardDemoInit() does "Same as calling keyboardInit(NULL, 3, BgType_Text4bpp, BgSize_T_256x512, 20, 0, false, true)"
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests