[SDL] Keyboard events problem

Ghazan Haider ghazanhaider at yahoo.com
Sun Aug 5 18:16:01 PDT 2001


Hi, I'm new to this list...

I have been learning the SDL library functions and on
two different computers and in linux and BeOS, I have
a little problem getting the keyboard events.

Take the following prog:

#include<stdio.h>
#include"SDL/SDL.h"
 main()
{
SDL_Event event;
SDL_Init(SDL_INIT_VIDEO);

while(1)
     {
     if (SDL_PollEvent($event) != NULL)
          printf("\n%d",&event.key.keysym);  
          /* Or similar without the & */
     }
SDL_Quit();
}

-----------


This produces a constant value continuously  at keysym
in the console and X11 mode. All graphics functions
work fine. Is there some additional Initialization for
the keyboard events?? The documentation doesnt suggest
as such.

Would someone please show me a little demo prog that
just outputs in printf variable keys pressed. I havent
found such a prog yet.. the testkeys.c in SDL-1.2.2
just shows the values of the keys.. doesnt input
anything. I'm using two very standard computers and
even the -Wall arg to gcc doesnt give any warnings. 
Thanks for help in advance.
Ghazan Haider



__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/




More information about the SDL mailing list