Source code translated to english

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@697 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2009-03-27 16:50:21 +00:00
parent 6b4a8f674e
commit efbc978e6f
68 changed files with 22766 additions and 22766 deletions

344
input.c
View File

@@ -29,8 +29,8 @@
#include "divers.h"
#include "input.h"
void Handle_Window_Resize(SDL_ResizeEvent event);
void Handle_Window_Exit(SDL_QuitEvent event);
void Handle_window_resize(SDL_ResizeEvent event);
void Handle_window_exit(SDL_QuitEvent event);
byte Directional_up;
byte Directional_up_right;
@@ -45,41 +45,41 @@ long Directional_last_move;
long Directional_step;
short Mouse_count; // Number of mouse movements received in the current Get_input()
word INPUT_Nouveau_Mouse_X;
word INPUT_Nouveau_Mouse_Y;
byte INPUT_Nouveau_Mouse_K;
word Input_new_mouse_X;
word Input_new_mouse_Y;
byte Input_new_mouse_K;
// TODO: move to config
short Button_shift=-1; // Button number that serves as a "shift" modifier
short Button_control=-1; // Button number that serves as a "ctrl" modifier
short Button_alt=-1; // Button number that serves as a "alt" modifier
short Button_clic_gauche=0; // Button number that serves as left click
short Button_clic_droit=0; // Button number that serves as right-click
short Joybutton_shift=-1; // Button number that serves as a "shift" modifier
short Joybutton_control=-1; // Button number that serves as a "ctrl" modifier
short Joybutton_alt=-1; // Button number that serves as a "alt" modifier
short Joybutton_left_click=0; // Button number that serves as left click
short Joybutton_right_click=0; // Button number that serves as right-click
int Est_Raccourci(word Touche, word function)
int Is_shortcut(word Key, word function)
{
if (Touche == 0)
if (Key == 0)
return 0;
if (function & 0x100)
{
if (Bouton[function&0xFF].Raccourci_gauche[0]==Touche)
if (Button[function&0xFF].Left_shortcut[0]==Key)
return 1;
if (Bouton[function&0xFF].Raccourci_gauche[1]==Touche)
if (Button[function&0xFF].Left_shortcut[1]==Key)
return 1;
return 0;
}
if (function & 0x200)
{
if (Bouton[function&0xFF].Raccourci_droite[0]==Touche)
if (Button[function&0xFF].Right_shortcut[0]==Key)
return 1;
if (Bouton[function&0xFF].Raccourci_droite[1]==Touche)
if (Button[function&0xFF].Right_shortcut[1]==Key)
return 1;
return 0;
}
if(Touche == Config_Touche[function][0])
if(Key == Config_Key[function][0])
return 1;
if(Touche == Config_Touche[function][1])
if(Key == Config_Key[function][1])
return 1;
return 0;
}
@@ -91,34 +91,34 @@ int Move_cursor_with_constraints()
//Gestion "avancée" du curseur: interdire la descente du curseur dans le
//menu lorsqu'on est en train de travailler dans l'image
if (Operation_Taille_pile != 0)
if (Operation_stack_size != 0)
{
byte bl=0;//BL va indiquer si on doit corriger la position du curseur
//Si le curseur ne se trouve plus dans l'image
if(Menu_Ordonnee<=INPUT_Nouveau_Mouse_Y)
if(Menu_Y<=Input_new_mouse_Y)
{
//On bloque le curseur en fin d'image
bl++;
INPUT_Nouveau_Mouse_Y=Menu_Ordonnee-1; //La ligne !!au-dessus!! du menu
Input_new_mouse_Y=Menu_Y-1; //La ligne !!au-dessus!! du menu
}
if(Loupe_Mode)
if(Main_magnifier_mode)
{
if(Operation_dans_loupe==0)
if(Operation_in_magnifier==0)
{
if(INPUT_Nouveau_Mouse_X>=Principal_Split)
if(Input_new_mouse_X>=Main_separator_position)
{
bl++;
INPUT_Nouveau_Mouse_X=Principal_Split-1;
Input_new_mouse_X=Main_separator_position-1;
}
}
else
{
if(INPUT_Nouveau_Mouse_X<Principal_X_Zoom)
if(Input_new_mouse_X<Main_X_zoom)
{
bl++;
INPUT_Nouveau_Mouse_X=Principal_X_Zoom;
Input_new_mouse_X=Main_X_zoom;
}
}
}
@@ -126,26 +126,26 @@ int Move_cursor_with_constraints()
if (bl)
{
SDL_WarpMouse(
INPUT_Nouveau_Mouse_X*Pixel_width,
INPUT_Nouveau_Mouse_Y*Pixel_height
Input_new_mouse_X*Pixel_width,
Input_new_mouse_Y*Pixel_height
);
}
}
if ((INPUT_Nouveau_Mouse_X != Mouse_X) ||
(INPUT_Nouveau_Mouse_Y != Mouse_Y) ||
(INPUT_Nouveau_Mouse_K != Mouse_K))
if ((Input_new_mouse_X != Mouse_X) ||
(Input_new_mouse_Y != Mouse_Y) ||
(Input_new_mouse_K != Mouse_K))
{
if ((INPUT_Nouveau_Mouse_K != Mouse_K))
if ((Input_new_mouse_K != Mouse_K))
feedback=1;
Effacer_curseur(); // On efface le curseur AVANT de le déplacer...
Mouse_X=INPUT_Nouveau_Mouse_X;
Mouse_Y=INPUT_Nouveau_Mouse_Y;
Mouse_K=INPUT_Nouveau_Mouse_K;
Calculer_coordonnees_pinceau();
Afficher_curseur();
Hide_cursor(); // On efface le curseur AVANT de le déplacer...
Mouse_X=Input_new_mouse_X;
Mouse_Y=Input_new_mouse_Y;
Mouse_K=Input_new_mouse_K;
Compute_paintbrush_coordinates();
Display_cursor();
Mouse_count++;
if (Mouse_count>Config.Mouse_Merge_movement)
if (Mouse_count>Config.Mouse_merge_movement)
feedback=1;
}
@@ -154,50 +154,50 @@ int Move_cursor_with_constraints()
// WM events management
void Handle_Window_Resize(SDL_ResizeEvent event)
void Handle_window_resize(SDL_ResizeEvent event)
{
Resize_Largeur = event.w;
Resize_Hauteur = event.h;
Resize_width = event.w;
Resize_height = event.h;
}
void Handle_Window_Exit(__attribute__((unused)) SDL_QuitEvent event)
void Handle_window_exit(__attribute__((unused)) SDL_QuitEvent event)
{
Quit_demande = 1;
Quit_is_required = 1;
}
// Mouse events management
int Handle_Mouse_Move(SDL_MouseMotionEvent event)
int Handle_mouse_move(SDL_MouseMotionEvent event)
{
INPUT_Nouveau_Mouse_X = event.x/Pixel_width;
INPUT_Nouveau_Mouse_Y = event.y/Pixel_height;
Input_new_mouse_X = event.x/Pixel_width;
Input_new_mouse_Y = event.y/Pixel_height;
return Move_cursor_with_constraints();
}
int Handle_Mouse_Click(SDL_MouseButtonEvent event)
int Handle_mouse_click(SDL_MouseButtonEvent event)
{
switch(event.button)
{
case SDL_BUTTON_LEFT:
INPUT_Nouveau_Mouse_K |= 1;
Input_new_mouse_K |= 1;
break;
case SDL_BUTTON_RIGHT:
INPUT_Nouveau_Mouse_K |= 2;
Input_new_mouse_K |= 2;
break;
case SDL_BUTTON_MIDDLE:
Touche = TOUCHE_MOUSEMIDDLE|Modificateurs_Touche(SDL_GetModState());
Key = KEY_MOUSEMIDDLE|Key_modifiers(SDL_GetModState());
// TODO: systeme de répétition
return 0;
case SDL_BUTTON_WHEELUP:
Touche = TOUCHE_MOUSEWHEELUP|Modificateurs_Touche(SDL_GetModState());
Key = KEY_MOUSEWHEELUP|Key_modifiers(SDL_GetModState());
return 0;
case SDL_BUTTON_WHEELDOWN:
Touche = TOUCHE_MOUSEWHEELDOWN|Modificateurs_Touche(SDL_GetModState());
Key = KEY_MOUSEWHEELDOWN|Key_modifiers(SDL_GetModState());
return 0;
default:
return 0;
@@ -205,16 +205,16 @@ int Handle_Mouse_Click(SDL_MouseButtonEvent event)
return Move_cursor_with_constraints();
}
int Handle_Mouse_Release(SDL_MouseButtonEvent event)
int Handle_mouse_release(SDL_MouseButtonEvent event)
{
switch(event.button)
{
case SDL_BUTTON_LEFT:
INPUT_Nouveau_Mouse_K &= ~1;
Input_new_mouse_K &= ~1;
break;
case SDL_BUTTON_RIGHT:
INPUT_Nouveau_Mouse_K &= ~2;
Input_new_mouse_K &= ~2;
break;
}
return Move_cursor_with_constraints();
@@ -222,108 +222,108 @@ int Handle_Mouse_Release(SDL_MouseButtonEvent event)
// Keyboard management
int Handle_Key_Press(SDL_KeyboardEvent event)
int Handle_key_press(SDL_KeyboardEvent event)
{
//Appui sur une touche du clavier
Touche = Conversion_Touche(event.keysym);
Touche_ANSI = Conversion_ANSI(event.keysym);
Key = Keysym_to_keycode(event.keysym);
Key_ANSI = Keysym_to_ANSI(event.keysym);
if(Est_Raccourci(Touche,SPECIAL_MOUSE_UP))
if(Is_shortcut(Key,SPECIAL_MOUSE_UP))
{
Directional_up=1;
return 0;
}
else if(Est_Raccourci(Touche,SPECIAL_MOUSE_DOWN))
else if(Is_shortcut(Key,SPECIAL_MOUSE_DOWN))
{
Directional_down=1;
return 0;
}
else if(Est_Raccourci(Touche,SPECIAL_MOUSE_LEFT))
else if(Is_shortcut(Key,SPECIAL_MOUSE_LEFT))
{
Directional_left=1;
return 0;
}
else if(Est_Raccourci(Touche,SPECIAL_MOUSE_RIGHT))
else if(Is_shortcut(Key,SPECIAL_MOUSE_RIGHT))
{
Directional_right=1;
return 0;
}
else if(Est_Raccourci(Touche,SPECIAL_CLICK_LEFT))
else if(Is_shortcut(Key,SPECIAL_CLICK_LEFT))
{
INPUT_Nouveau_Mouse_K=1;
Input_new_mouse_K=1;
return Move_cursor_with_constraints();
}
else if(Est_Raccourci(Touche,SPECIAL_CLICK_RIGHT))
else if(Is_shortcut(Key,SPECIAL_CLICK_RIGHT))
{
INPUT_Nouveau_Mouse_K=2;
Input_new_mouse_K=2;
return Move_cursor_with_constraints();
}
if (Operation_Taille_pile!=0 && Touche != 0)
if (Operation_stack_size!=0 && Key != 0)
{
//Enfin, on inhibe les touches (sauf si c'est un changement de couleur
//ou de taille de pinceau lors d'une des operations suivantes:
//OPERATION_DESSIN_CONTINU, OPERATION_DESSIN_DISCONTINU, OPERATION_SPRAY)
if(Autoriser_changement_de_couleur_pendant_operation)
//OPERATION_CONTINUOUS_DRAW, OPERATION_DISCONTINUOUS_DRAW, OPERATION_AIRBRUSH)
if(Allow_color_change_during_operation)
{
//A ce stade là, on sait qu'on est dans une des 3 opérations
//supportant le changement de couleur ou de taille de pinceau.
if(
(!Est_Raccourci(Touche,SPECIAL_NEXT_FORECOLOR)) &&
(!Est_Raccourci(Touche,SPECIAL_PREVIOUS_FORECOLOR)) &&
(!Est_Raccourci(Touche,SPECIAL_NEXT_BACKCOLOR)) &&
(!Est_Raccourci(Touche,SPECIAL_PREVIOUS_BACKCOLOR)) &&
(!Est_Raccourci(Touche,SPECIAL_RETRECIR_PINCEAU)) &&
(!Est_Raccourci(Touche,SPECIAL_GROSSIR_PINCEAU)) &&
(!Est_Raccourci(Touche,SPECIAL_NEXT_USER_FORECOLOR)) &&
(!Est_Raccourci(Touche,SPECIAL_PREVIOUS_USER_FORECOLOR)) &&
(!Est_Raccourci(Touche,SPECIAL_NEXT_USER_BACKCOLOR)) &&
(!Est_Raccourci(Touche,SPECIAL_PREVIOUS_USER_BACKCOLOR))
(!Is_shortcut(Key,SPECIAL_NEXT_FORECOLOR)) &&
(!Is_shortcut(Key,SPECIAL_PREVIOUS_FORECOLOR)) &&
(!Is_shortcut(Key,SPECIAL_NEXT_BACKCOLOR)) &&
(!Is_shortcut(Key,SPECIAL_PREVIOUS_BACKCOLOR)) &&
(!Is_shortcut(Key,SPECIAL_SMALLER_PAINTBRUSH)) &&
(!Is_shortcut(Key,SPECIAL_BIGGER_PAINTBRUSH)) &&
(!Is_shortcut(Key,SPECIAL_NEXT_USER_FORECOLOR)) &&
(!Is_shortcut(Key,SPECIAL_PREVIOUS_USER_FORECOLOR)) &&
(!Is_shortcut(Key,SPECIAL_NEXT_USER_BACKCOLOR)) &&
(!Is_shortcut(Key,SPECIAL_PREVIOUS_USER_BACKCOLOR))
)
{
Touche=0;
Key=0;
}
}
else Touche = 0;
else Key = 0;
}
return 0;
}
int Relache_controle(int CodeTouche, int Modifieur)
int Release_control(int key_code, int modifier)
{
if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_UP][0]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_UP][0]&Modifieur) ||
CodeTouche == (Config_Touche[SPECIAL_MOUSE_UP][1]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_UP][1]&Modifieur))
if(key_code == (Config_Key[SPECIAL_MOUSE_UP][0]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_UP][0]&modifier) ||
key_code == (Config_Key[SPECIAL_MOUSE_UP][1]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_UP][1]&modifier))
{
Directional_up=0;
}
if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_DOWN][0]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_DOWN][0]&Modifieur) ||
CodeTouche == (Config_Touche[SPECIAL_MOUSE_DOWN][1]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_DOWN][1]&Modifieur))
if(key_code == (Config_Key[SPECIAL_MOUSE_DOWN][0]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_DOWN][0]&modifier) ||
key_code == (Config_Key[SPECIAL_MOUSE_DOWN][1]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_DOWN][1]&modifier))
{
Directional_down=0;
}
if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_LEFT][0]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_LEFT][0]&Modifieur) ||
CodeTouche == (Config_Touche[SPECIAL_MOUSE_LEFT][1]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_LEFT][1]&Modifieur))
if(key_code == (Config_Key[SPECIAL_MOUSE_LEFT][0]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_LEFT][0]&modifier) ||
key_code == (Config_Key[SPECIAL_MOUSE_LEFT][1]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_LEFT][1]&modifier))
{
Directional_left=0;
}
if(CodeTouche == (Config_Touche[SPECIAL_MOUSE_RIGHT][0]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_RIGHT][0]&Modifieur) ||
CodeTouche == (Config_Touche[SPECIAL_MOUSE_RIGHT][1]&0x0FFF) || (Config_Touche[SPECIAL_MOUSE_RIGHT][1]&Modifieur))
if(key_code == (Config_Key[SPECIAL_MOUSE_RIGHT][0]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_RIGHT][0]&modifier) ||
key_code == (Config_Key[SPECIAL_MOUSE_RIGHT][1]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_RIGHT][1]&modifier))
{
Directional_right=0;
}
if(CodeTouche == (Config_Touche[SPECIAL_CLICK_LEFT][0]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_LEFT][0]&Modifieur) ||
CodeTouche == (Config_Touche[SPECIAL_CLICK_LEFT][1]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_LEFT][1]&Modifieur))
if(key_code == (Config_Key[SPECIAL_CLICK_LEFT][0]&0x0FFF) || (Config_Key[SPECIAL_CLICK_LEFT][0]&modifier) ||
key_code == (Config_Key[SPECIAL_CLICK_LEFT][1]&0x0FFF) || (Config_Key[SPECIAL_CLICK_LEFT][1]&modifier))
{
INPUT_Nouveau_Mouse_K &= ~1;
Input_new_mouse_K &= ~1;
return Move_cursor_with_constraints();
}
if(CodeTouche == (Config_Touche[SPECIAL_CLICK_RIGHT][0]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_RIGHT][0]&Modifieur) ||
CodeTouche == (Config_Touche[SPECIAL_CLICK_RIGHT][1]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_RIGHT][1]&Modifieur))
if(key_code == (Config_Key[SPECIAL_CLICK_RIGHT][0]&0x0FFF) || (Config_Key[SPECIAL_CLICK_RIGHT][0]&modifier) ||
key_code == (Config_Key[SPECIAL_CLICK_RIGHT][1]&0x0FFF) || (Config_Key[SPECIAL_CLICK_RIGHT][1]&modifier))
{
INPUT_Nouveau_Mouse_K &= ~2;
Input_new_mouse_K &= ~2;
return Move_cursor_with_constraints();
}
@@ -334,62 +334,62 @@ int Relache_controle(int CodeTouche, int Modifieur)
}
int Handle_Key_Release(SDL_KeyboardEvent event)
int Handle_key_release(SDL_KeyboardEvent event)
{
int Modifieur;
int ToucheR = Conversion_Touche(event.keysym) & 0x0FFF;
int modifier;
int released_key = Keysym_to_keycode(event.keysym) & 0x0FFF;
switch(event.keysym.sym)
{
case SDLK_RSHIFT:
case SDLK_LSHIFT:
Modifieur=MOD_SHIFT;
modifier=MOD_SHIFT;
break;
case SDLK_RCTRL:
case SDLK_LCTRL:
Modifieur=MOD_CTRL;
modifier=MOD_CTRL;
break;
case SDLK_RALT:
case SDLK_LALT:
case SDLK_MODE:
Modifieur=MOD_ALT;
modifier=MOD_ALT;
break;
default:
Modifieur=0;
modifier=0;
}
return Relache_controle(ToucheR, Modifieur);
return Release_control(released_key, modifier);
}
// Joystick management
int Handle_Joystick_Press(SDL_JoyButtonEvent event)
int Handle_joystick_press(SDL_JoyButtonEvent event)
{
if (event.which==0) // joystick number 0
if (event.which==0) // Joystick number 0
{
if (event.button == Button_shift)
if (event.button == Joybutton_shift)
{
SDL_SetModState(SDL_GetModState() | KMOD_SHIFT);
return 0;
}
if (event.button == Button_control)
if (event.button == Joybutton_control)
{
SDL_SetModState(SDL_GetModState() | KMOD_CTRL);
return 0;
}
if (event.button == Button_alt)
if (event.button == Joybutton_alt)
{
SDL_SetModState(SDL_GetModState() | (KMOD_ALT|KMOD_META));
return 0;
}
if (event.button == Button_clic_gauche)
if (event.button == Joybutton_left_click)
{
INPUT_Nouveau_Mouse_K=1;
Input_new_mouse_K=1;
return Move_cursor_with_constraints();
}
if (event.button == Button_clic_droit)
if (event.button == Joybutton_right_click)
{
INPUT_Nouveau_Mouse_K=2;
Input_new_mouse_K=2;
return Move_cursor_with_constraints();
}
#ifdef __gp2x__
@@ -424,7 +424,7 @@ int Handle_Joystick_Press(SDL_JoyButtonEvent event)
default:
}
#endif
Touche = (TOUCHE_BUTTON+event.button)|Modificateurs_Touche(SDL_GetModState());
Key = (KEY_JOYBUTTON+event.button)|Key_modifiers(SDL_GetModState());
// TODO: systeme de répétition
return Move_cursor_with_constraints();
@@ -432,24 +432,24 @@ int Handle_Joystick_Press(SDL_JoyButtonEvent event)
return 0;
}
int Handle_Joystick_Release(SDL_JoyButtonEvent event)
int Handle_joystick_release(SDL_JoyButtonEvent event)
{
if (event.which==0) // joystick number 0
if (event.which==0) // Joystick number 0
{
if (event.button == Button_shift)
if (event.button == Joybutton_shift)
{
SDL_SetModState(SDL_GetModState() & ~KMOD_SHIFT);
return Relache_controle(0,MOD_SHIFT);
return Release_control(0,MOD_SHIFT);
}
if (event.button == Button_control)
if (event.button == Joybutton_control)
{
SDL_SetModState(SDL_GetModState() & ~KMOD_CTRL);
return Relache_controle(0,MOD_CTRL);
return Release_control(0,MOD_CTRL);
}
if (event.button == Button_alt)
if (event.button == Joybutton_alt)
{
SDL_SetModState(SDL_GetModState() & ~(KMOD_ALT|KMOD_META));
return Relache_controle(0,MOD_ALT);
return Release_control(0,MOD_ALT);
}
#ifdef __gp2x__
@@ -480,20 +480,20 @@ int Handle_Joystick_Release(SDL_JoyButtonEvent event)
Directional_up_left=0;
break;
case GP2X_BUTTON_A: // A
INPUT_Nouveau_Mouse_K &= ~1;
Input_new_mouse_K &= ~1;
break;
case GP2X_BUTTON_B: // B
INPUT_Nouveau_Mouse_K &= ~2;
Input_new_mouse_K &= ~2;
break;
}
#else
switch(event.button)
{
case 0: // A
INPUT_Nouveau_Mouse_K &= ~1;
Input_new_mouse_K &= ~1;
break;
case 1: // B
INPUT_Nouveau_Mouse_K &= ~2;
Input_new_mouse_K &= ~2;
break;
}
#endif
@@ -501,9 +501,9 @@ int Handle_Joystick_Release(SDL_JoyButtonEvent event)
return Move_cursor_with_constraints();
}
void Handle_Joystick_Movement(SDL_JoyAxisEvent event)
void Handle_joystick_movement(SDL_JoyAxisEvent event)
{
if (event.which==0) // joystick number 0
if (event.which==0) // Joystick number 0
{
#ifndef NO_JOYCURSOR
if (event.axis==0) // X
@@ -531,34 +531,34 @@ void Handle_Joystick_Movement(SDL_JoyAxisEvent event)
}
// Attempts to move the mouse cursor by the given deltas (may be more than 1 pixel at a time)
int Cursor_displace(short Delta_X, short Delta_Y)
int Cursor_displace(short delta_x, short delta_y)
{
short x=INPUT_Nouveau_Mouse_X;
short y=INPUT_Nouveau_Mouse_Y;
short x=Input_new_mouse_X;
short y=Input_new_mouse_Y;
if(Loupe_Mode && INPUT_Nouveau_Mouse_Y < Menu_Ordonnee && INPUT_Nouveau_Mouse_X > Principal_Split)
if(Main_magnifier_mode && Input_new_mouse_Y < Menu_Y && Input_new_mouse_X > Main_separator_position)
{
// Cursor in zoomed area
if (Delta_X<0)
INPUT_Nouveau_Mouse_X = Max(Principal_Split, x-Loupe_Facteur);
else if (Delta_X>0)
INPUT_Nouveau_Mouse_X = Min(Largeur_ecran-1, x+Loupe_Facteur);
if (Delta_Y<0)
INPUT_Nouveau_Mouse_Y = Max(0, y-Loupe_Facteur);
else if (Delta_Y>0)
INPUT_Nouveau_Mouse_Y = Min(Hauteur_ecran-1, y+Loupe_Facteur);
if (delta_x<0)
Input_new_mouse_X = Max(Main_separator_position, x-Main_magnifier_factor);
else if (delta_x>0)
Input_new_mouse_X = Min(Screen_width-1, x+Main_magnifier_factor);
if (delta_y<0)
Input_new_mouse_Y = Max(0, y-Main_magnifier_factor);
else if (delta_y>0)
Input_new_mouse_Y = Min(Screen_height-1, y+Main_magnifier_factor);
}
else
{
if (Delta_X<0)
INPUT_Nouveau_Mouse_X = Max(0, x+Delta_X);
else if (Delta_X>0)
INPUT_Nouveau_Mouse_X = Min(Largeur_ecran-1, x+Delta_X);
if (Delta_Y<0)
INPUT_Nouveau_Mouse_Y = Max(0, y+Delta_Y);
else if (Delta_Y>0)
INPUT_Nouveau_Mouse_Y = Min(Hauteur_ecran-1, y+Delta_Y);
if (delta_x<0)
Input_new_mouse_X = Max(0, x+delta_x);
else if (delta_x>0)
Input_new_mouse_X = Min(Screen_width-1, x+delta_x);
if (delta_y<0)
Input_new_mouse_Y = Max(0, y+delta_y);
else if (delta_y>0)
Input_new_mouse_Y = Min(Screen_height-1, y+delta_y);
}
return Move_cursor_with_constraints();
}
@@ -569,64 +569,64 @@ int Cursor_displace(short Delta_X, short Delta_Y)
int Get_input(void)
{
SDL_Event event;
int User_Feedback_Required = 0; // Flag qui indique si on doit arrêter de traiter les évènements ou si on peut enchainer
int user_feedback_required = 0; // Flag qui indique si on doit arrêter de traiter les évènements ou si on peut enchainer
Touche_ANSI = 0;
Touche = 0;
Key_ANSI = 0;
Key = 0;
Mouse_count=0;
// Process as much events as possible without redrawing the screen.
// This mostly allows us to merge mouse events for people with an high
// resolution mouse
while( (!User_Feedback_Required) && SDL_PollEvent(&event)) // Try to cumulate for a full VBL except if there is a required feedback
while( (!user_feedback_required) && SDL_PollEvent(&event)) // Try to cumulate for a full VBL except if there is a required feedback
{
switch(event.type)
{
case SDL_VIDEORESIZE:
Handle_Window_Resize(event.resize);
User_Feedback_Required = 1;
Handle_window_resize(event.resize);
user_feedback_required = 1;
break;
case SDL_QUIT:
Handle_Window_Exit(event.quit);
User_Feedback_Required = 1;
Handle_window_exit(event.quit);
user_feedback_required = 1;
break;
case SDL_MOUSEMOTION:
User_Feedback_Required = Handle_Mouse_Move(event.motion);
user_feedback_required = Handle_mouse_move(event.motion);
break;
case SDL_MOUSEBUTTONDOWN:
Handle_Mouse_Click(event.button);
User_Feedback_Required = 1;
Handle_mouse_click(event.button);
user_feedback_required = 1;
break;
case SDL_MOUSEBUTTONUP:
Handle_Mouse_Release(event.button);
User_Feedback_Required = 1;
Handle_mouse_release(event.button);
user_feedback_required = 1;
break;
case SDL_KEYDOWN:
Handle_Key_Press(event.key);
User_Feedback_Required = 1;
Handle_key_press(event.key);
user_feedback_required = 1;
break;
case SDL_KEYUP:
Handle_Key_Release(event.key);
Handle_key_release(event.key);
break;
case SDL_JOYBUTTONUP:
Handle_Joystick_Release(event.jbutton);
User_Feedback_Required = 1;
Handle_joystick_release(event.jbutton);
user_feedback_required = 1;
break;
case SDL_JOYBUTTONDOWN:
Handle_Joystick_Press(event.jbutton);
User_Feedback_Required = 1;
Handle_joystick_press(event.jbutton);
user_feedback_required = 1;
break;
case SDL_JOYAXISMOTION:
Handle_Joystick_Movement(event.jaxis);
Handle_joystick_movement(event.jaxis);
break;
default:
@@ -694,5 +694,5 @@ int Get_input(void)
// (c'est fait ici car on est sur que cette function est apellée partout ou on a besoin d'interragir avec l'utilisateur)
Flush_update();
return User_Feedback_Required;
return user_feedback_required;
}