This repository was archived by the owner on Sep 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
mouse motion event under simulator #26
Copy link
Copy link
Open
Description
I don't know if I'm doing something wrong or if there is an issue with SDL_MOUSEMOTION event under the simulator. Although I don't think the problem is in my code. I receive SDL_MOUSEBUTTONDOWN & SDL_MOUSEBUTTONUP events but never the SDL_MOUSEMOTION event
Below is a snippet code for my event loop function and I never get the SDL_MOUSEMOTION event:
eventloop()
{
// we'll be using this for event polling
SDL_Event ev;
bool gotEvent = false;
if ( SDL_IsPaused )
{
SDL_WaitEvent(&ev);
gotEvent = true;
}
else
gotEvent = (SDL_PollEvent(&ev) != 0);
while (gotEvent)
{
fprintf( stderr,"ev.type = %d\n", ev.type );
switch (ev.type)
{
case SDL_MOUSEBUTTONDOWN:
{
fprintf( stderr,"SDL_MOUSEBUTTONDOWN\n" );
// do something
}
break;
case SDL_MOUSEBUTTONUP:
{
fprintf( stderr,"SDL_MOUSEBUTTONUP\n" );
// do something
}
}
break;
case SDL_MOUSEMOTION:
{
fprintf( stderr,"SDL_MOUSEMOTION\n" );
// do something
}
break;
// List of keys that have been pressed
case SDL_KEYDOWN:
{
fprintf( stderr,"SDL_KEYDOWN\n" );
switch (ev.key.keysym.sym)
{
// Escape forces us to quit the app
// this is also sent when the user makes a back gesture
case SDLK_ESCAPE:
ev.type = SDL_QUIT;
break;
default:
break;
}
break;
}
break;
case SDL_ACTIVEEVENT:
{
fprintf( stderr,"SDL_ACTIVEEVENT\n" );
if (ev.active.state == SDL_APPACTIVE)
{
SDL_IsPaused = !ev.active.gain;
}
}
break;
case SDL_QUIT:
{
fprintf( stderr,"SDL_QUIT\n" );
mbGameRunning = false;
}
break;
}
gotEvent = (SDL_PollEvent(&ev) != 0);
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels