Removed Wait_VBL. Was only used for slowing down things. Used SDL_Delay(1) instead, which let the OS handle other things. We should get about 10-20ms latency with that. Scrollbars may be slightly faster. The only place where this could be a problem is discontinuous freehand. If the current way it works isn't good, look at the "Chrono" functions (like the spray) instead.

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

View File

@@ -448,7 +448,7 @@ void Move_separator(void)
Display_cursor();
}
}
if(!Get_input())Wait_VBL();
if(!Get_input())SDL_Delay(1);
}
// Effacer la barre en XOR
@@ -895,7 +895,7 @@ void Main_handler(void)
}
}
}
else Wait_VBL(); // 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(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
// 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())Wait_VBL();
while(!Get_input())SDL_Delay(1);
if (Mouse_K==LEFT_SIDE)
{
@@ -1858,7 +1858,7 @@ void Get_color_behind_window(byte * color, byte * click)
do
{
if(!Get_input())Wait_VBL();
if(!Get_input())SDL_Delay(1);
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) Wait_VBL();
while(!Get_input() && new_x==Mouse_X-dx && new_y==Mouse_Y-dy) SDL_Delay(1);
new_x=Mouse_X-dx;
@@ -2151,8 +2151,7 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
do
{
// Attente
if(!Get_input())
Wait_VBL();
if(!Get_input()) SDL_Delay(1);
// 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;
@@ -2198,8 +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())
Wait_VBL();
if(!Get_input()) SDL_Delay(1);
if (!Mouse_K)
{
Hide_cursor();
@@ -2213,8 +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())
Wait_VBL();
if(!Get_input()) SDL_Delay(1);
if (!Mouse_K)
return 0;
}
@@ -2448,7 +2445,7 @@ short Window_clicked_button(void)
{
short Button;
if(!Get_input())Wait_VBL();
if(!Get_input())SDL_Delay(1);
// Gestion des clicks
if (Mouse_K)