* Use SDL_WaitEvent instead of SDL_PollEvent.
* To avoid the program getting 'locked' when there is no user input (sliders, colorspray), we use a timer that queues events to make grafX2 act (and refresh the screen) TODO : * To reduce cpu usage when idle even more, start the timer only when it's needed (colorspray is drawing, or a scrollbar is scrolling) * For now everyone uses the same timer, so the same delay. This means there is no fast-scroll and slow-scroll for sliders. Starting the timer with a different speed in each case would solve that * The event handling for sliders will currently react to any mouse event. Thismeans the slider will move faster if you slightly move the mouse while keeping in the button. Not what wewant, so weshoud all a timer_expired global and the slider should wait for that (and reset it when acknowledged). git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1556 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
11
src/misc.c
11
src/misc.c
@@ -675,17 +675,6 @@ void Rescale(byte *src_buffer, short src_width, short src_height, byte *dst_buff
|
||||
}
|
||||
}
|
||||
|
||||
void Slider_timer(byte speed)
|
||||
//Boucle d'attente pour faire bouger les scrollbars à une vitesse correcte
|
||||
{
|
||||
Uint32 end;
|
||||
byte original_mouse_k = Mouse_K;
|
||||
end = SDL_GetTicks() + speed*10;
|
||||
do
|
||||
{
|
||||
if (!Get_input()) SDL_Delay(20);
|
||||
} while (Mouse_K == original_mouse_k && SDL_GetTicks()<end);
|
||||
}
|
||||
|
||||
void Scroll_picture(byte * main_src, byte * main_dest, short x_offset,short y_offset)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user