Fixed all sdl_delays to wait for 20ms, not 1. Avoid problems for low-latency guys.

Also, made the splash screen stay as long as you don't click or key. Mouse moves are discarded. Sorry!


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@800 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-05-12 19:05:33 +00:00
parent 3c0a940301
commit ff83f12b31
5 changed files with 14 additions and 14 deletions

View File

@ -135,7 +135,7 @@ void Button_Message_initial(void)
Display_cursor();
while(!Get_input()) SDL_Delay(1);
while(!Get_input() && !Mouse_K && !Key) SDL_Delay(20);
if (Mouse_K)
Wait_end_of_click();

View File

@ -448,7 +448,7 @@ void Move_separator(void)
Display_cursor();
}
}
if(!Get_input())SDL_Delay(1);
if(!Get_input())SDL_Delay(20);
}
// Effacer la barre en XOR
@ -895,7 +895,7 @@ void Main_handler(void)
}
}
}
else SDL_Delay(1); // S'il n'y a pas d'évènement, on ne gère pas tout ça et on attend un peu. La partie en dessous doit être exécutée quand
else SDL_Delay(20); // S'il n'y a pas d'évènement, on ne gère pas tout ça et on attend un peu. La partie en dessous doit être exécutée quand
// même pour les trucs asynchrones, par exemple le spray.
// Gestion de la souris
@ -1772,7 +1772,7 @@ short Wait_click_in_palette(T_Palette_button * button)
for (;;)
{
while(!Get_input())SDL_Delay(1);
while(!Get_input())SDL_Delay(20);
if (Mouse_K==LEFT_SIDE)
{
@ -1858,7 +1858,7 @@ void Get_color_behind_window(byte * color, byte * click)
do
{
if(!Get_input())SDL_Delay(1);
if(!Get_input())SDL_Delay(20);
if ((Mouse_X!=old_x) || (Mouse_Y!=old_y))
{
@ -1953,7 +1953,7 @@ void Move_window(short dx, short dy)
old_x=new_x;
old_y=new_y;
while(!Get_input() && new_x==Mouse_X-dx && new_y==Mouse_Y-dy) SDL_Delay(1);
while(!Get_input() && new_x==Mouse_X-dx && new_y==Mouse_Y-dy) SDL_Delay(20);
new_x=Mouse_X-dx;
@ -2151,7 +2151,7 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
do
{
// Attente
if(!Get_input()) SDL_Delay(1);
if(!Get_input()) SDL_Delay(20);
// Mise à jour du survol
selected_index=Window_click_in_rectangle(2,2,Button->Dropdown_width-2,box_height-1)?
(((Mouse_Y-Window_pos_Y)/Menu_factor_Y-2)>>3) : -1;
@ -2197,7 +2197,7 @@ short Window_normal_button_onclick(word x_pos, word y_pos, word width, word heig
Display_cursor();
while (Window_click_in_rectangle(x_pos,y_pos,x_pos+width-1,y_pos+height-1))
{
if(!Get_input()) SDL_Delay(1);
if(!Get_input()) SDL_Delay(20);
if (!Mouse_K)
{
Hide_cursor();
@ -2211,7 +2211,7 @@ short Window_normal_button_onclick(word x_pos, word y_pos, word width, word heig
Display_cursor();
while (!(Window_click_in_rectangle(x_pos,y_pos,x_pos+width-1,y_pos+height-1)))
{
if(!Get_input()) SDL_Delay(1);
if(!Get_input()) SDL_Delay(20);
if (!Mouse_K)
return 0;
}
@ -2445,7 +2445,7 @@ short Window_clicked_button(void)
{
short Button;
if(!Get_input())SDL_Delay(1);
if(!Get_input())SDL_Delay(20);
// Gestion des clicks
if (Mouse_K)

2
help.c
View File

@ -88,7 +88,7 @@ void Redefine_control(word *shortcut, int x_pos, int y_pos)
Display_cursor();
while (1)
{
while(!Get_input())SDL_Delay(1);
while(!Get_input())SDL_Delay(20);
if (Key==KEY_ESC)
return;
if (Key!=0)

4
misc.c
View File

@ -125,7 +125,7 @@ void Wait_end_of_click(void)
{
// On désactive tous les raccourcis clavier
while(Mouse_K) if(!Get_input()) SDL_Delay(1);
while(Mouse_K) if(!Get_input()) SDL_Delay(20);
}
void Hide_current_image_with_stencil(byte color, byte * stencil)
@ -626,7 +626,7 @@ void Slider_timer(byte speed)
end = SDL_GetTicks() + speed*10;
do
{
if (!Get_input()) SDL_Delay(1);
if (!Get_input()) SDL_Delay(20);
} while (Mouse_K == original_mouse_k && SDL_GetTicks()<end);
}

View File

@ -181,7 +181,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
Display_cursor();
do
{
if(!Get_input()) SDL_Delay(1);
if(!Get_input()) SDL_Delay(20);
input_key=Key_ANSI;
} while(input_key==0);
Hide_cursor();