Fixed the double icons having their diagonal not shaded on selection.

Fixed the Ellipse / Grad ellipse icon graphics (were quite off-centered)
Some tidy-up of input.c


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@584 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-02-02 23:09:06 +00:00
parent 1150dcea21
commit 5a80cdae44
5 changed files with 102 additions and 83 deletions

View File

@ -1749,7 +1749,6 @@ void Bouton_Rectangle_plein(void)
void Bouton_Cercle_vide(void) void Bouton_Cercle_vide(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_CERCLES,10);
Demarrer_pile_operation(OPERATION_CERCLE_VIDE); Demarrer_pile_operation(OPERATION_CERCLE_VIDE);
Afficher_curseur(); Afficher_curseur();
} }
@ -1758,7 +1757,6 @@ void Bouton_Cercle_vide(void)
void Bouton_Ellipse_vide(void) void Bouton_Ellipse_vide(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_CERCLES,11);
Demarrer_pile_operation(OPERATION_ELLIPSE_VIDE); Demarrer_pile_operation(OPERATION_ELLIPSE_VIDE);
Afficher_curseur(); Afficher_curseur();
} }
@ -1767,7 +1765,6 @@ void Bouton_Ellipse_vide(void)
void Bouton_Cercle_plein(void) void Bouton_Cercle_plein(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_CERCLES,10);
Demarrer_pile_operation(OPERATION_CERCLE_PLEIN); Demarrer_pile_operation(OPERATION_CERCLE_PLEIN);
Afficher_curseur(); Afficher_curseur();
} }
@ -1776,7 +1773,6 @@ void Bouton_Cercle_plein(void)
void Bouton_Ellipse_pleine(void) void Bouton_Ellipse_pleine(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_CERCLES,11);
Demarrer_pile_operation(OPERATION_ELLIPSE_PLEINE); Demarrer_pile_operation(OPERATION_ELLIPSE_PLEINE);
Afficher_curseur(); Afficher_curseur();
} }
@ -2107,7 +2103,6 @@ void Bouton_Degrades(void)
void Bouton_Cercle_degrade(void) void Bouton_Cercle_degrade(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_SPHERES,16);
Demarrer_pile_operation(OPERATION_CERCLE_DEGRADE); Demarrer_pile_operation(OPERATION_CERCLE_DEGRADE);
Afficher_curseur(); Afficher_curseur();
} }
@ -2116,7 +2111,6 @@ void Bouton_Cercle_degrade(void)
void Bouton_Ellipse_degrade(void) void Bouton_Ellipse_degrade(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_SPHERES,17);
Demarrer_pile_operation(OPERATION_ELLIPSE_DEGRADEE); Demarrer_pile_operation(OPERATION_ELLIPSE_DEGRADEE);
Afficher_curseur(); Afficher_curseur();
} }
@ -2137,7 +2131,6 @@ void Bouton_Fill(void)
if (Operation_en_cours!=OPERATION_FILL) if (Operation_en_cours!=OPERATION_FILL)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_FLOODFILL,14);
if (Operation_en_cours!=OPERATION_REMPLACER) if (Operation_en_cours!=OPERATION_REMPLACER)
{ {
@ -2159,7 +2152,6 @@ void Bouton_Remplacer(void)
if (Operation_en_cours!=OPERATION_REMPLACER) if (Operation_en_cours!=OPERATION_REMPLACER)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_FLOODFILL,15);
if (Operation_en_cours!=OPERATION_FILL) if (Operation_en_cours!=OPERATION_FILL)
{ {
Pinceau_Forme_avant_fill=Pinceau_Forme; Pinceau_Forme_avant_fill=Pinceau_Forme;
@ -5538,7 +5530,6 @@ void Bouton_Trame_Menu(void)
void Bouton_Polygone(void) void Bouton_Polygone(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_POLYGONES,12);
Demarrer_pile_operation(OPERATION_POLYGONE); Demarrer_pile_operation(OPERATION_POLYGONE);
Afficher_curseur(); Afficher_curseur();
} }
@ -5547,7 +5538,6 @@ void Bouton_Polygone(void)
void Bouton_Polyform(void) void Bouton_Polyform(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_POLYGONES,13);
Demarrer_pile_operation(OPERATION_POLYFORM); Demarrer_pile_operation(OPERATION_POLYFORM);
Afficher_curseur(); Afficher_curseur();
} }
@ -5556,7 +5546,6 @@ void Bouton_Polyform(void)
void Bouton_Polyfill(void) void Bouton_Polyfill(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_POLYGONES,12);
Demarrer_pile_operation(OPERATION_POLYFILL); Demarrer_pile_operation(OPERATION_POLYFILL);
Afficher_curseur(); Afficher_curseur();
} }
@ -5565,7 +5554,6 @@ void Bouton_Polyfill(void)
void Bouton_Filled_polyform(void) void Bouton_Filled_polyform(void)
{ {
Effacer_curseur(); Effacer_curseur();
Afficher_sprite_dans_menu(BOUTON_POLYGONES,13);
Demarrer_pile_operation(OPERATION_FILLED_POLYFORM); Demarrer_pile_operation(OPERATION_FILLED_POLYFORM);
Afficher_curseur(); Afficher_curseur();
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

138
input.c
View File

@ -28,8 +28,8 @@
#include "windows.h" #include "windows.h"
#include "erreurs.h" #include "erreurs.h"
void Handle_Window_Resize(SDL_Event* event); void Handle_Window_Resize(SDL_ResizeEvent event);
void Handle_Window_Exit(SDL_Event* event); void Handle_Window_Exit(SDL_QuitEvent event);
byte Directional_up; byte Directional_up;
byte Directional_up_right; byte Directional_up_right;
@ -114,42 +114,42 @@ void Gere_Evenement_SDL(SDL_Event * event)
// Redimensionnement fenetre // Redimensionnement fenetre
if (event->type == SDL_VIDEORESIZE ) if (event->type == SDL_VIDEORESIZE )
{ {
Handle_Window_Resize(event); Handle_Window_Resize(event->resize);
} }
// Fermeture // Fermeture
if (event->type == SDL_QUIT ) if (event->type == SDL_QUIT )
{ {
Handle_Window_Exit(event); Handle_Window_Exit(event->quit);
} }
} }
// WM events management // WM events management
void Handle_Window_Resize(SDL_Event* event) void Handle_Window_Resize(SDL_ResizeEvent event)
{ {
Resize_Largeur = event->resize.w; Resize_Largeur = event.w;
Resize_Hauteur = event->resize.h; Resize_Hauteur = event.h;
} }
void Handle_Window_Exit(SDL_Event* event) void Handle_Window_Exit(__attribute__((unused)) SDL_QuitEvent event)
{ {
Quit_demande = 1; Quit_demande = 1;
} }
// Mouse events management // Mouse events management
int Handle_Mouse_Move(SDL_Event* event) int Handle_Mouse_Move(SDL_MouseMotionEvent event)
{ {
INPUT_Nouveau_Mouse_X = event->motion.x/Pixel_width; INPUT_Nouveau_Mouse_X = event.x/Pixel_width;
INPUT_Nouveau_Mouse_Y = event->motion.y/Pixel_height; INPUT_Nouveau_Mouse_Y = event.y/Pixel_height;
return Move_cursor_with_constraints(); return Move_cursor_with_constraints();
} }
void Handle_Mouse_Click(SDL_Event* event) void Handle_Mouse_Click(SDL_MouseButtonEvent event)
{ {
switch(event->button.button) switch(event.button)
{ {
case SDL_BUTTON_LEFT: case SDL_BUTTON_LEFT:
INPUT_Nouveau_Mouse_K |= 1; INPUT_Nouveau_Mouse_K |= 1;
@ -169,9 +169,9 @@ void Handle_Mouse_Click(SDL_Event* event)
Move_cursor_with_constraints(); Move_cursor_with_constraints();
} }
void Handle_Mouse_Release(SDL_Event* event) void Handle_Mouse_Release(SDL_MouseButtonEvent event)
{ {
switch(event->button.button) switch(event.button)
{ {
case SDL_BUTTON_LEFT: case SDL_BUTTON_LEFT:
INPUT_Nouveau_Mouse_K &= ~1; INPUT_Nouveau_Mouse_K &= ~1;
@ -190,11 +190,11 @@ void Handle_Mouse_Release(SDL_Event* event)
// Keyboard management // Keyboard management
int Handle_Key_Press(SDL_Event* event) int Handle_Key_Press(SDL_KeyboardEvent event)
{ {
//Appui sur une touche du clavier //Appui sur une touche du clavier
Touche = Conversion_Touche(event->key.keysym); Touche = Conversion_Touche(event.keysym);
Touche_ANSI = Conversion_ANSI(event->key.keysym); Touche_ANSI = Conversion_ANSI(event.keysym);
if(Touche == Config_Touche[SPECIAL_MOUSE_UP]) if(Touche == Config_Touche[SPECIAL_MOUSE_UP])
{ {
@ -260,12 +260,12 @@ int Handle_Key_Press(SDL_Event* event)
return 0; return 0;
} }
void Handle_Key_Release(SDL_Event* event) void Handle_Key_Release(SDL_KeyboardEvent event)
{ {
int Modifieur; int Modifieur;
int ToucheR = Conversion_Touche(event->key.keysym) & 0x0FFF; int ToucheR = Conversion_Touche(event.keysym) & 0x0FFF;
switch(event->key.keysym.sym) switch(event.keysym.sym)
{ {
case SDLK_RSHIFT: case SDLK_RSHIFT:
case SDLK_LSHIFT: case SDLK_LSHIFT:
@ -319,46 +319,48 @@ void Handle_Key_Release(SDL_Event* event)
// Joystick management // Joystick management
void Handle_Joystick_Press(SDL_Event* event) void Handle_Joystick_Press(SDL_JoyButtonEvent event)
{ {
if (event->jbutton.which==0) // joystick number 0 if (event.which==0) // joystick number 0
{ {
#ifdef __gp2x__ #ifdef __gp2x__
switch(event->jbutton.button) switch(event.button)
{ {
case 0: #ifndef NO_JOYCURSOR
case GP2X_BUTTON_UP:
Directional_up=1; Directional_up=1;
break; break;
case 7: case GP2X_BUTTON_UPRIGHT:
Directional_up_right=1; Directional_up_right=1;
break; break;
case 6: case GP2X_BUTTON_RIGHT:
Directional_right=1; Directional_right=1;
break; break;
case 5: case GP2X_BUTTON_DOWNRIGHT:
Directional_down_right=1; Directional_down_right=1;
break; break;
case 4: case GP2X_BUTTON_DOWN:
Directional_down=1; Directional_down=1;
break; break;
case 3: case GP2X_BUTTON_DOWNLEFT:
Directional_down_left=1; Directional_down_left=1;
break; break;
case 2: case GP2X_BUTTON_LEFT:
Directional_left=1; Directional_left=1;
break; break;
case 1: case GP2X_BUTTON_UPLEFT:
Directional_up_left=1; Directional_up_left=1;
break; break;
case 12: // A #endif
case GP2X_BUTTON_A: // A
INPUT_Nouveau_Mouse_K=1; INPUT_Nouveau_Mouse_K=1;
break; break;
case 13: // B case GP2X_BUTTON_B: // B
INPUT_Nouveau_Mouse_K=2; INPUT_Nouveau_Mouse_K=2;
break; break;
} }
#else #else
switch(event->jbutton.button) switch(event.button)
{ {
case 0: // A case 0: // A
INPUT_Nouveau_Mouse_K=1; INPUT_Nouveau_Mouse_K=1;
@ -371,46 +373,46 @@ void Handle_Joystick_Press(SDL_Event* event)
} }
} }
void Handle_Joystick_Release(SDL_Event* event) void Handle_Joystick_Release(SDL_JoyButtonEvent event)
{ {
if (event->jbutton.which==0) // joystick number 0 if (event.which==0) // joystick number 0
{ {
#ifdef __gp2x__ #ifdef __gp2x__
switch(event->jbutton.button) switch(event.button)
{ {
case 0: case GP2X_BUTTON_UP:
Directional_up=0; Directional_up=0;
break; break;
case 7: case GP2X_BUTTON_UPRIGHT:
Directional_up_right=0; Directional_up_right=0;
break; break;
case 6: case GP2X_BUTTON_RIGHT:
Directional_right=0; Directional_right=0;
break; break;
case 5: case GP2X_BUTTON_DOWNRIGHT:
Directional_down_right=0; Directional_down_right=0;
break; break;
case 4: case GP2X_BUTTON_DOWN:
Directional_down=0; Directional_down=0;
break; break;
case 3: case GP2X_BUTTON_DOWNLEFT:
Directional_down_left=0; Directional_down_left=0;
break; break;
case 2: case GP2X_BUTTON_LEFT:
Directional_left=0; Directional_left=0;
break; break;
case 1: case GP2X_BUTTON_UPLEFT:
Directional_up_left=0; Directional_up_left=0;
break; break;
case 12: // A case GP2X_BUTTON_A: // A
INPUT_Nouveau_Mouse_K &= ~1; INPUT_Nouveau_Mouse_K &= ~1;
break; break;
case 13: // B case GP2X_BUTTON_B: // B
INPUT_Nouveau_Mouse_K &= ~2; INPUT_Nouveau_Mouse_K &= ~2;
break; break;
} }
#else #else
switch(event->jbutton.button) switch(event.button)
{ {
case 0: // A case 0: // A
INPUT_Nouveau_Mouse_K &= ~1; INPUT_Nouveau_Mouse_K &= ~1;
@ -423,30 +425,32 @@ void Handle_Joystick_Release(SDL_Event* event)
} }
} }
void Handle_Joystick_Movement(SDL_Event* event) void Handle_Joystick_Movement(SDL_JoyAxisEvent event)
{ {
if (event->jaxis.which==0) // joystick number 0 if (event.which==0) // joystick number 0
{ {
if (event->jaxis.axis==0) // X #ifndef NO_JOYCURSOR
if (event.axis==0) // X
{ {
Directional_right=Directional_left=0; Directional_right=Directional_left=0;
if (event->jaxis.value<-1000) if (event.value<-1000)
{ {
Directional_left=1; Directional_left=1;
} }
else if (event->jaxis.value>1000) else if (event.value>1000)
Directional_right=1; Directional_right=1;
} }
else if (event->jaxis.axis==1) // Y else if (event.axis==1) // Y
{ {
Directional_up=Directional_down=0; Directional_up=Directional_down=0;
if (event->jaxis.value<-1000) if (event.value<-1000)
{ {
Directional_up=1; Directional_up=1;
} }
else if (event->jaxis.value>1000) else if (event.value>1000)
Directional_down=1; Directional_down=1;
} }
#endif
} }
} }
@ -468,50 +472,50 @@ int Get_input(void)
switch(event.type) switch(event.type)
{ {
case SDL_VIDEORESIZE: case SDL_VIDEORESIZE:
Handle_Window_Resize(&event); Handle_Window_Resize(event.resize);
User_Feedback_Required = 1; User_Feedback_Required = 1;
break; break;
case SDL_QUIT: case SDL_QUIT:
Handle_Window_Exit(&event); Handle_Window_Exit(event.quit);
User_Feedback_Required = 1; User_Feedback_Required = 1;
break; break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
User_Feedback_Required = Handle_Mouse_Move(&event); User_Feedback_Required = Handle_Mouse_Move(event.motion);
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
Handle_Mouse_Click(&event); Handle_Mouse_Click(event.button);
User_Feedback_Required = 1; User_Feedback_Required = 1;
break; break;
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
Handle_Mouse_Release(&event); Handle_Mouse_Release(event.button);
User_Feedback_Required = 1; User_Feedback_Required = 1;
break; break;
case SDL_KEYDOWN: case SDL_KEYDOWN:
Handle_Key_Press(&event); Handle_Key_Press(event.key);
User_Feedback_Required = 1; User_Feedback_Required = 1;
break; break;
case SDL_KEYUP: case SDL_KEYUP:
Handle_Key_Release(&event); Handle_Key_Release(event.key);
break; break;
case SDL_JOYBUTTONUP: case SDL_JOYBUTTONUP:
Handle_Joystick_Release(&event); Handle_Joystick_Release(event.jbutton);
User_Feedback_Required = 1; User_Feedback_Required = 1;
break; break;
case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONDOWN:
Handle_Joystick_Press(&event); Handle_Joystick_Press(event.jbutton);
User_Feedback_Required = 1; User_Feedback_Required = 1;
break; break;
case SDL_JOYAXISMOTION: case SDL_JOYAXISMOTION:
Handle_Joystick_Movement(&event); Handle_Joystick_Movement(event.jaxis);
break; break;
default: default:

View File

@ -347,9 +347,28 @@ void Enclencher_bouton(int Numero,byte Click)
{ {
int Famille; int Famille;
int Curseur; int Curseur;
int Icone;
Effacer_curseur(); Effacer_curseur();
// Certains boutons ont deux icones
Icone=-1;
switch(Numero)
{
case BOUTON_POLYGONES:
case BOUTON_POLYFILL:
Icone=12;break;
case BOUTON_FLOODFILL:
Icone=14;break;
case BOUTON_CERCLES:
case BOUTON_FILLCERC:
Icone=10;break;
case BOUTON_SPHERES:
Icone=16;break;
}
if (Icone!=-1)
Afficher_sprite_dans_menu(Numero,Icone+(Click==A_DROITE));
// On note déjà la famille du bouton (La "Famiglia" c'est sacré) // On note déjà la famille du bouton (La "Famiglia" c'est sacré)
Famille=Bouton[Numero].Famille; Famille=Bouton[Numero].Famille;

View File

@ -747,12 +747,20 @@ void Afficher_sprite_dans_menu(int Numero_bouton,int Numero_sprite)
word Pos_menu_Y; word Pos_menu_Y;
byte Couleur; byte Couleur;
for (Pos_Y=0,Pos_menu_Y=Bouton[Numero_bouton].Decalage_Y+1;Pos_Y<HAUTEUR_SPRITE_MENU;Pos_Y++,Pos_menu_Y++) Pos_menu_Y=Bouton[Numero_bouton].Decalage_Y;
for (Pos_X=0,Pos_menu_X=Bouton[Numero_bouton].Decalage_X+1;Pos_X<LARGEUR_SPRITE_MENU;Pos_X++,Pos_menu_X++) Pos_menu_X=Bouton[Numero_bouton].Decalage_X;
if (Bouton[Numero_bouton].Forme != FORME_BOUTON_TRIANGLE_BAS_DROITE)
{
Pos_menu_Y+=1;
Pos_menu_X+=1;
}
for (Pos_Y=0;Pos_Y<HAUTEUR_SPRITE_MENU;Pos_Y++)
for (Pos_X=0;Pos_X<LARGEUR_SPRITE_MENU;Pos_X++)
{ {
Couleur=SPRITE_MENU[Numero_sprite][Pos_Y][Pos_X]; Couleur=SPRITE_MENU[Numero_sprite][Pos_Y][Pos_X];
Pixel_dans_menu(Pos_menu_X,Pos_menu_Y,Couleur); Pixel_dans_menu(Pos_menu_X+Pos_X,Pos_menu_Y+Pos_Y,Couleur);
BLOCK_MENU[Pos_menu_Y][Pos_menu_X]=Couleur; BLOCK_MENU[Pos_menu_Y+Pos_Y][Pos_menu_X+Pos_X]=Couleur;
} }
UpdateRect(Menu_Facteur_X*(Bouton[Numero_bouton].Decalage_X+1), UpdateRect(Menu_Facteur_X*(Bouton[Numero_bouton].Decalage_X+1),
(Bouton[Numero_bouton].Decalage_Y+1)*Menu_Facteur_Y+Menu_Ordonnee, (Bouton[Numero_bouton].Decalage_Y+1)*Menu_Facteur_Y+Menu_Ordonnee,