gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Keyboard library?

#163876 - azaydius - Tue Oct 14, 2008 6:22 am

I have been searching for a while for a library that provides simple keyboard input functionality on the touch screen, but without much luck.

Do most developers code their own for each project or is there some simple library I am missing in devkitARM that provides something similar? Any advice would be much appreciated! :)

#163881 - hacker013 - Tue Oct 14, 2008 12:17 pm

look here: http://headkaze.drunkencoders.com/
_________________
Website / Blog

Let the nds be with you.

#163883 - eKid - Tue Oct 14, 2008 1:47 pm

I think there's going to be a keyboard thingy built into the next libnds

#163907 - azaydius - Tue Oct 14, 2008 10:14 pm

hacker013 wrote:
look here: http://headkaze.drunkencoders.com/


You, sir, are now my favorite. :) Much thanks!

#163909 - zzo38computer - Tue Oct 14, 2008 10:19 pm

It would be useful if it support Unicode as well
_________________
Important: Please send messages about FWNITRO to the public forum, not privately to me.

#163940 - dovoto - Thu Oct 16, 2008 12:11 am

Yes, next libnds will support keyboard interface. This functionality is complete and in the cvs (cvs is of course use at your own risk). Usage would be something like the below:

Code:
#include <nds.h>
#include <stdio.h>


void OnKeyPressed(int key)
{
   if(key > 0)
      iprintf("%c", key);
}

int main(void)
{
   irqInit();
   irqEnable(IRQ_VBLANK);

   consoleDemoInit();

   Keyboard *kbd = keyboardGetDefault();

   kbd->OnKeyPressed = OnKeyPressed;

   keyboardInit(kbd);

   while(1)
   {
      char myName[256];

      iprintf("What is your name?\n");

      scanf("%s", myName);

      iprintf("\nHello %s", myName);

      scanKeys();
      while(!keysDown())scanKeys();

      swiWaitForVBlank();
      consoleClear();
   }

   return 0;
}


This would cause a keyboard to pop up on the sub screen when you call scanf and auto hide after the input is attained. This behavior can be modified by adjusting attributes to the Keyboard structure.

You could also hide and show the keyboard without stdin.

I would like to get support for numeric keypad and a minimized version of the keyboard before the release but not a priority.
_________________
www.drunkencoders.com