c - SDL event sequences on wheel movement -
i new sdl , maintaining sdl application. want know (and how) events delivered when user play wheel. in app user modify size of little square on screen using mouse wheel. found out app slow when user turning wheel.
basically there 1 big loop
sdl_event event; for(;;){ // sdl_waitevent(&event); sdl_lockmutex(mymutex); switch(event.type){ case sdl_customevent: //handle 2 or 3 customs events break; case sdl_keydown: //handle keydown break; case sdl_videoexpose: //handle keydown break; case sdl_mousebuttondown: switch(event.button.button){ case sdl_button_right: break; case sdl_button_right: break; case sdl_button_wheelup: <---------------------- /** recompute size of box. also, not believe, update whole screen redrawing images each time. **/ break; case sdl_button_wheeldown: //same above break; } break; } //etc.... sdl_unlockmutex(mymutex); }
so thread executing loop sharing data thread, , because both threads can preempted wheel events consumed slowly.
i want aggregate processing of wheel events, instance doing
while(//there wheel down or up){ //change direction variables sdl_peepevents(//wheel events); } //update screen
is there direct way catch wheel events sdl_peepevents? mean alternative peep mouse events (sdl_mousebuttondown
) , test if button wheel. saw in sdl 1.3 documentation there sdl_mousewheel
event type. on other side . available sdl 1.2 (the version using). sdl_mousewheel
, sdl_mousebuttondown
both sent when user acts wheel?
ps: have no access c++
Comments
Post a Comment