diff --git a/boutons.c b/boutons.c index 8b473fb2..90cc70df 100644 --- a/boutons.c +++ b/boutons.c @@ -1388,6 +1388,7 @@ void Bouton_Resol(void) Readline(62,37,Chaine,4,1); Largeur_choisie=atoi(Chaine); // On corrige les dimensions + DEBUG("Valide",0); if (Largeur_choisie==0) { Largeur_choisie=1; diff --git a/divers.c b/divers.c index 225f0a1c..8d74d324 100644 --- a/divers.c +++ b/divers.c @@ -647,9 +647,11 @@ void Scroll_picture(short Decalage_X,short Decalage_Y) UNIMPLEMENTED } -byte Get_key(void) +word Get_key(void) { - SDL_Event event; + SDL_Event event; + + Attendre_fin_de_click(); // On prend le controle de la boucle d'évènements, donc il ne faut pas qu'on rate la fin de click ! SDL_EnableUNICODE(SDL_ENABLE); // On a besoin du caractère @@ -660,7 +662,13 @@ byte Get_key(void) { // On retourne en mode standard pour la gestion normale SDL_EnableUNICODE(SDL_DISABLE); - return (byte)(event.key.keysym.unicode); + if (event.key.keysym.unicode <= 127 && event.key.keysym.unicode > 31) + return event.key.keysym.unicode; // Pas de souci, on est en ASCII standard + else + { + // Sinon c'est une touche spéciale, on retourne son scancode + return event.key.keysym.sym; + } } } } diff --git a/divers.h b/divers.h index 557d39bc..4489b502 100644 --- a/divers.h +++ b/divers.h @@ -25,7 +25,7 @@ void Wait_VBL(void); void Tempo_jauge(byte Vitesse); dword Round_div(dword Numerateur,dword Diviseur); word Palette_Compter_nb_couleurs_utilisees(dword * Tableau); -byte Get_key(void); +word Get_key(void); void Pixel_dans_ecran_courant (word X,word Y,byte Couleur); void Pixel_dans_brosse (word X,word Y,byte Couleur); diff --git a/linux.c b/linux.c index bd97bf92..485011ef 100644 --- a/linux.c +++ b/linux.c @@ -25,5 +25,5 @@ int filelength(int fichier) void itoa(int source,char* dest, int longueur) { - printf("itoa non implémenté!\n"); + snprintf(dest,longueur,"%d",source); } diff --git a/readline.c b/readline.c index e79d2481..980c42c6 100644 --- a/readline.c +++ b/readline.c @@ -100,7 +100,7 @@ byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_maxi,byte Type_sai char Chaine_initiale[256]; byte Position; byte Taille; - char Touche_lue=0; + word Touche_lue=0; byte Touche_autorisee; @@ -120,16 +120,12 @@ byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_maxi,byte Type_sai Rafficher_toute_la_chaine(Pos_X,Pos_Y,Chaine,Position); - while ((Touche_lue!=13) && (Touche_lue!=27)) + while ((Touche_lue!=SDLK_RETURN) && (Touche_lue!=SDLK_ESCAPE)) { Touche_lue=Get_key(); switch (Touche_lue) { - case 0 : - Touche_lue=Get_key(); - switch (Touche_lue) - { - case 83 : // Suppr. + case SDLK_DELETE : // Suppr. if (Position