Still work on SDL events. Airbrush seems to work. Need to do repeatable buttons.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1565 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
35
src/engine.c
35
src/engine.c
@@ -598,7 +598,7 @@ void Move_separator(void)
|
||||
Display_cursor();
|
||||
}
|
||||
}
|
||||
if(!Get_input())SDL_Delay(20);
|
||||
Get_input();
|
||||
}
|
||||
|
||||
// Effacer la barre en XOR
|
||||
@@ -1299,21 +1299,7 @@ void Main_handler(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
// No event : we go asleep for a while, but we try to get waked up at constant intervals of time
|
||||
// no matter the machine speed or system load. The time is fixed to 10ms (that should be about a cpu slice on most systems)
|
||||
// This allows nice smooth mouse movement.
|
||||
const int delay = 10;
|
||||
|
||||
Uint32 debut;
|
||||
debut = SDL_GetTicks();
|
||||
// Première attente : le complément de "delay" millisecondes
|
||||
SDL_Delay(delay - (debut % delay));
|
||||
// Si ça ne suffit pas, on complète par des attentes successives de "1ms".
|
||||
// (Remarque, Windows arrondit généralement aux 10ms supérieures)
|
||||
while ( SDL_GetTicks()/delay <= debut/delay)
|
||||
{
|
||||
SDL_Delay(1);
|
||||
}
|
||||
// Removed all SDL_Delay() timing here: relying on Get_input()
|
||||
}
|
||||
|
||||
// Gestion de la souris
|
||||
@@ -2272,7 +2258,7 @@ short Wait_click_in_palette(T_Palette_button * button)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
while(!Get_input())SDL_Delay(20);
|
||||
Get_input();
|
||||
|
||||
if (Mouse_K==LEFT_SIDE)
|
||||
{
|
||||
@@ -2353,7 +2339,7 @@ void Get_color_behind_window(byte * color, byte * click)
|
||||
|
||||
do
|
||||
{
|
||||
if(!Get_input())SDL_Delay(20);
|
||||
Get_input();
|
||||
|
||||
if ((Mouse_X!=old_x) || (Mouse_Y!=old_y))
|
||||
{
|
||||
@@ -2440,7 +2426,10 @@ 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(20);
|
||||
do
|
||||
{
|
||||
Get_input();
|
||||
} while(new_x==Mouse_X-dx && new_y==Mouse_Y-dy);
|
||||
|
||||
new_x=Mouse_X-dx;
|
||||
|
||||
@@ -2642,7 +2631,7 @@ T_Dropdown_choice * Dropdown_activate(T_Dropdown_button *button, short off_x, sh
|
||||
do
|
||||
{
|
||||
// Attente
|
||||
if(!Get_input()) SDL_Delay(20);
|
||||
Get_input();
|
||||
// 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;
|
||||
@@ -2713,7 +2702,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(20);
|
||||
Get_input();
|
||||
if (!Mouse_K)
|
||||
{
|
||||
Hide_cursor();
|
||||
@@ -2727,7 +2716,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(20);
|
||||
Get_input();
|
||||
if (!Mouse_K)
|
||||
return 0;
|
||||
}
|
||||
@@ -2991,7 +2980,7 @@ short Window_clicked_button(void)
|
||||
{
|
||||
short Button;
|
||||
|
||||
if(!Get_input())SDL_Delay(20);
|
||||
Get_input();
|
||||
|
||||
// Handle clicks
|
||||
if (Mouse_K)
|
||||
|
||||
Reference in New Issue
Block a user