Hi all
I'm porting some code over from GLX to SDL but am having some problems with key detection so I tried this simple bit of code and it still didn't work? Do I need to set up screens or something?
int main()
{
int x=0;
extern void DetectButtons(void);
SDL_Init( SDL_INIT_EVERYTHING );
/****************** init the system ************************************/
do
{
DetectButtons();
sleep(1);
x++;
}while(x<10);
}
the event loop is
void DetectButtons(void)
{
SDL_PollEvent( &DetectEvent );
printf("event %d ",DetectEvent.type);
switch(DetectEvent.type)
{
case SDL_KEYDOWN:
printf("Key press\n");
break;
case SDL_MOUSEMOTION:
printf("mouse motion\n");
break;
}
}
Detect event is a global. Thanks:)
Sorry totally forgot how to post code thought it was
? Obviously not