> It seems that keyboard_waitforupdate doesn't block properly.  I have
> a loop like:
>
> while(1) {
>       keyboard_waitforupdate();
>       if(keyboard_keypressed(SCANCODE_ESCAPE))
>               break;
> }
>
> that sucks up 100% of cpu.  what am I missing?

I don't immediately see anything wrong. I assume you begin with
keyboard_init().

This probably wouldn't be any better, but you could try it:

   while (!keyboard_keypressed(SCANCODE_ESCAPE))
   {
      keyboard_update();
   }

Maybe you don't need raw keyboard mode, anyway? You could try something
like this:

   int input;

   input = vga_getch();

   if (input == '\33')
   {
      while (input != 0) { input = vga_getkey(); }
   }

This will scan for the Escape key, as well as the arrows and the Function
keys. If the first value returned by vga_getkey() is 0 (i.e., nothing),
then you know if was the Esc key. Otherwise, it was something else.

For example, here we can look for Esc and the arrows:

   int input;

   input = vga_getch();

   if (input == '\33')
   {
      input = vga_getkey();
      if (input == 0) { /* Esc key */ }

      else
      {
         if (input == 27) { input = vga_getkey(); }
         if (input == 91) { input = vga_getkey(); }
         if (input == 79) { input = vga_getkey(); }

         if      (input == 65) { /*  up arrow    */ }
         else if (input == 66) { /*  down arrow  */ }
         else if (input == 67) { /*  right arrow */ }
         else if (input == 68) { /*  left arrow  */ }
      }
   }


------------------------------------------------------------------
Unsubscribe:  To:   [EMAIL PROTECTED]
              Body: unsubscribe linux-svgalib

Reply via email to