Fonction externe
extern void efface_LCD() //Efface l'ecran sur les 2 plans
{
SetPlane(DARK_PLANE); //Active le plan gris fonce
ClrScr(); //Efface le plan
SetPlane(LIGHT_PLANE); //Active le plan gris clair
ClrScr(); //Efface le plan
}
extern void carre(short x0,short y0,short x1,short y1,short attr) //Dessine un rectangle de x0,y0 a x1,y1
{
DrawLine(x0,y0,x0,y1,attr); //Dessine une ligne de x0,y0 a x1,y1
DrawLine(x0,y1,x1,y1,attr); //Dessine une ligne de x0,y1 a x1,y1
DrawLine(x1,y1,x1,y0,attr); //Dessine une ligne de x1,y1 a x1,y0
DrawLine(x1,y0,x0,y0,attr); //Dessine une ligne de x1,y0 a x0,y0
}
La fonction ou ca bugge
// C Source File
// Created 19/09/2002; 12:16:52
#include <tigcclib.h>
extern void main_music()
{
unsigned char bouledark[]={ 0x3C, 0x4E, 0x87, 0x87, 0xCF, 0x7E, 0x3C, 0x0};
unsigned char boulelight[]={0x3C,0x72,0xC9,0xC9,0xB1,0x42,0x3C,0x0};
void dessine_dossier(short y , short attr) //Dessine les dossier
{
unsigned char dossierdark[]={ 0x70, 0x8E, 0x81, 0x81, 0x81, 0x81, 0x7E, 0x0};
unsigned char dossierlight[]={0x70,0xFE,0xCF,0xC3,0xC3,0xFF,0x7E,0xFF};
Sprite8(0, y, 7, dossierdark, GetPlane(DARK_PLANE), attr);
Sprite8(0, y, 7, dossierlight, GetPlane(LIGHT_PLANE), attr);
}
void bouge_boule(long selection) //efface le sprite dosier pour mettre boule ou inversement
{
Sprite8(0, ((selection*8)-6), 7, bouledark, GetPlane(DARK_PLANE), SPRT_XOR);
Sprite8(0, ((selection*8)-6), 7, boulelight, GetPlane(LIGHT_PLANE), SPRT_XOR);
dessine_dossier(((selection*8)-6) , SPRT_XOR);
}
void dessine_tableau(short nombre) //Affiche les ligne et les dossier du tableau
{
int i=0;
if (nombre>12) {nombre=12;}
Sprite8(0, 2, 7, bouledark, GetPlane(DARK_PLANE), SPRT_XOR);
Sprite8(0, 2, 7, boulelight, GetPlane(LIGHT_PLANE), SPRT_XOR);
SetPlane(DARK_PLANE);
DrawLine(0, 1, 160,1, A_NORMAL);
DrawLine(0, 9, 160,9, A_NORMAL);
for (i = 2; i < nombre+1; i++)
{
dessine_dossier(((i*8)-6) , SPRT_OR);
DrawLine(0,((i*8)+1),160,((i*8)+1), A_NORMAL);
}
}
void gere_liste(int M,int N)
{
short i=0, hauteur=0;
short int sel=1, pos=1, decalage=0;
short keymusic=0;
char (*A)[N] = calloc(M*N,sizeof(char *));
if (M>12) {hauteur=12;} else {hauteur=M;}
FontSetSys(F_4x6);
void rempli_la_liste() <<<<<<<<<<<<<<<<< Ca bugge ici
{
strncpy((char *)A[1], "1abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[2], "2abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[3], "3abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[4], "4abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[5], "5abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[6], "6abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[7], "7abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[8], "8abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[9], "9abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[10], "10abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[11], "11abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[12], "12abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[13], "13abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[14], "14abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[15], "15abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[16], "16abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[17], "17abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[18], "18abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[19], "19abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[20], "20abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[21], "21abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[22], "22abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[23], "23abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[24], "24abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[25], "25abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[26], "26abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[27], "27abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[28], "28abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[29], "29abcdefghijklmnopqrstuvwxyz", N+1);
}
rempli_la_liste();
dessine_tableau(M);
void ecrit_liste()
{
SetPlane(DARK_PLANE);
for (i = 1; i < hauteur+1; i++)
{
DrawStr(10, ((i*8)-5), (char *)A[(i+decalage)] , A_XOR);
}
SetPlane(LIGHT_PLANE); // Active le plan gris clair
for (i = 1; i < hauteur+1; i++)
{
DrawStr(10, ((i*8)-5), (char *)A[(i+decalage)] , A_XOR);
}
}
ecrit_liste();
do
{
keymusic=ngetchx();
switch(keymusic)
{
case 340:
{
if (sel<M)
{
if (pos < 12)
{
bouge_boule(pos);
sel = sel+1;
pos = pos+1;
bouge_boule(pos);
}
else
{
ecrit_liste();
decalage = decalage+1;
sel = sel+1;
ecrit_liste();
}
}
}
break;
case 4436:
{
if (sel<M)
{
if (pos < 12)
{
bouge_boule(pos);
sel = sel+(12-pos);
pos = 12;
bouge_boule(pos);
}
else
{
ecrit_liste();
if ((sel+10) < M) {decalage = decalage+10; sel = sel+10;} else {decalage = decalage+(M-sel); sel = M;}
ecrit_liste();
}
}
}
break;
case 337:
{
if (sel>1)
{
if (pos > 1)
{
bouge_boule(pos);
sel=sel-1;
pos = pos-1;
bouge_boule(pos);
}
else
{
ecrit_liste();
decalage = decalage-1;
sel = sel-1;
ecrit_liste();
}
}
}
break;
case 4433:
{
if (sel>1)
{
if (pos > 1)
{
bouge_boule(pos);
sel = sel-(pos-1);
pos = 1;
bouge_boule(pos);
}
else
{
ecrit_liste();
if ((sel-10) >= 1) {decalage = decalage-10; sel = sel-10;} else {decalage = 0; sel = 1;}
ecrit_liste();
}
}
}
break;
}
} while(keymusic != 264);
free (A);
}
efface_LCD();
gere_liste(29,30);
}