Fixed sliders and repeatable buttons, for the change of timing method.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1567 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-08-09 22:56:06 +00:00
parent 84e81bbb3f
commit e4d6dcbcbe
3 changed files with 22 additions and 11 deletions

View File

@ -2748,7 +2748,7 @@ short Window_get_clicked_button(void)
Hide_cursor(); Hide_cursor();
Window_select_normal_button(temp1->Pos_X,temp1->Pos_Y,temp1->Width,temp1->Height); Window_select_normal_button(temp1->Pos_X,temp1->Pos_Y,temp1->Width,temp1->Height);
Display_cursor(); Display_cursor();
// Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider); Delay_with_active_mouse((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
Hide_cursor(); Hide_cursor();
Window_unselect_normal_button(temp1->Pos_X,temp1->Pos_Y,temp1->Width,temp1->Height); Window_unselect_normal_button(temp1->Pos_X,temp1->Pos_Y,temp1->Width,temp1->Height);
Display_cursor(); Display_cursor();
@ -2795,7 +2795,7 @@ short Window_get_clicked_button(void)
Display_cursor(); Display_cursor();
// Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider); Delay_with_active_mouse((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
Hide_cursor(); Hide_cursor();
Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11); Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11);
@ -2824,7 +2824,7 @@ short Window_get_clicked_button(void)
Display_cursor(); Display_cursor();
// Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider); Delay_with_active_mouse((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
Hide_cursor(); Hide_cursor();
Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11); Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11);
@ -2930,7 +2930,7 @@ short Window_get_button_shortcut(void)
Window_select_normal_button(temp->Pos_X,temp->Pos_Y,temp->Width,temp->Height); Window_select_normal_button(temp->Pos_X,temp->Pos_Y,temp->Width,temp->Height);
Display_cursor(); Display_cursor();
// Slider_timer(Config.Delay_right_click_on_slider); Delay_with_active_mouse(Config.Delay_right_click_on_slider);
Hide_cursor(); Hide_cursor();
Window_unselect_normal_button(temp->Pos_X,temp->Pos_Y,temp->Width,temp->Height); Window_unselect_normal_button(temp->Pos_X,temp->Pos_Y,temp->Width,temp->Height);
@ -3289,3 +3289,18 @@ void Remap_window_backgrounds(byte * conversion_table, int Min_Y, int Max_Y)
} }
} }
} }
void Delay_with_active_mouse(int speed)
{
Uint32 now;
Uint32 end;
end = SDL_GetTicks()+speed*10;
Need_Timer_events=1;
do
{
Get_input();
now = SDL_GetTicks();
} while (now<end);
}

View File

@ -111,4 +111,6 @@ void Pixel_background(int x_pos, int y_pos, byte color);
/// Updates the status bar line with a color number. /// Updates the status bar line with a color number.
/// Used when hovering the menu palette. /// Used when hovering the menu palette.
void Status_print_palette_color(byte color); void Status_print_palette_color(byte color);
void Delay_with_active_mouse(int delay);
#endif #endif

View File

@ -149,13 +149,7 @@ void Error_function(int error_code, const char *filename, int line_number, const
for (index=0;index<=255;index++) for (index=0;index<=255;index++)
temp_palette[index].R=255; temp_palette[index].R=255;
Set_palette(temp_palette); Set_palette(temp_palette);
SDL_Delay(500); Delay_with_active_mouse(50); // Half a second of red flash
// TODO: Replace the above by a loop where cursor is active:
// Need_Timer_events=1
// Compute target=now+500
// Do
// Get_input()
// While now<target
Set_palette(Main_palette); Set_palette(Main_palette);
} }
else else