[SDL] Strangle problem using keys

Sami Näätänen sn.ml at bayminer.com
Wed Nov 2 02:50:18 PST 2005


On Wednesday 02 November 2005 08:30, ALTAIR - wrote:
> #include "SDL.h"
> #include "stdio.h"
>
> int main(int argc, char *argv[])
> {
>
> 	unsigned int Tecla;
> 	unsigned char Salir;
>
>       SDL_Event event;
>
> 	Salir=0;
> 	while (Salir<1)
> 	{
>
> 		while (SDL_PollEvent(&event))
> 		{
> 			if (event.type==SDLK_UP)
> 			{
> 				printf("\nTecla pulsada");
> 				Salir=1;
> 			} else {
> 				printf("\nEsperando...");
> 			}
>
> 			keys=SDL_GetKeyState(NULL);
>
> 			if (keys[SDLK_UP])
> 			{
>
> 				printf("\nTecla pulsada");
> 				Salir=1;
> 			} else {
> 				printf("\nEsperando...");
> 			}
>
> 		}
> 	}
>
> 	return 0;
> }
>
> This compile, but not run...

Of course not you haven't even initialized SDL. How could it work?





More information about the SDL mailing list