I am not getting keyboard and mouse events under SDL 1.3. I seem to recall
a post a while back about some differences with SDL 1.3 and how it handles
events.
I have a routine (shown below) that checks events once per frame in my game
loop. I do get SDL_WINDOWEVENT’s, but no keyboard or mouse events.
Is there something I need to add to get these events? The minimum sample
Apps for SDL 1.3 don’t have anything else, but they are also not handling
mouse and keyboard events.
Ken
void ProcessEvents( void )
{
SDL_Event event;
SDL_PumpEvents();
if ( SDL_PeepEvents( &event,1,SDL_GETEVENT,SDL_ALLEVENTS ) )
{
switch( event.type )
{
#if ( SDL_MINOR_VERSION == 3 )
case SDL_WINDOWEVENT:
switch(
event.window.event )
{
case
SDL_WINDOWEVENT_CLOSE:
if ( g_pGame )
{
g_pGame->QuitGame();
}
break;
}
break;
#endif
case SDL_ACTIVEEVENT:
if (
event.active.state & (SDL_APPINPUTFOCUS|SDL_APPACTIVE) )
{
if ( event.active.gain == 0 )
{
// We lost focus
if ( g_pGame )
g_pGame->Pause();
}
else
{
// We got focus
if ( g_pGame )
g_pGame->Resume();
}
}
break;
case SDL_MOUSEBUTTONDOWN:
{
// Snipped code to save off mouse down info
// If I set a breakpoint here I never hit it
}
break;
case SDL_MOUSEBUTTONUP:
{
// Snipped code to save off mouse up info
// If I set a breakpoint here I never hit it
}
break;
case SDL_MOUSEMOTION:
{
// Snipped code to save off mouse motion info
// If I set a breakpoint here I never hit it
}
break;
case SDL_KEYDOWN:
case SDL_KEYUP:
{
// Snipped code to save off key down/up info
// If I set a breakpoint here I never hit it
}
break;
case SDL_QUIT:
if ( g_pGame
)
{
g_pGame->QuitGame();
}
break;
default:
break;
}
}
}