Back to index

gcompris  8.2.2
gtans.h
Go to the documentation of this file.
00001 
00002 
00003 #define AN_none 0
00004 #define AN_move 1
00005 #define AN_rot 2
00006 
00007 #define ARON 0.39999
00008 
00009 #define mPI 3.14159265356
00010 #define TOUR 65536
00011 #define PASTOUR (mPI/TOUR*2)
00012 #define CL 1.4142135624
00013 #define CC CL/2
00014 #define HT TOUR/8
00015 #define TYPENBR 5    /* nombre de type de pieces */
00016 #define PIECENBR 7   /* nombre de pieces par figure */
00017 #define TRINBRMAX 4  /* nombre de triangle max par piece */
00018 #define PNTNBRMAX 4  /* nombre de points max par piece */
00019 #define TINYNBR 32   /* nombre de tiny triangles */
00020 
00021 /* gc (couleur ou (couleur ou texture)) */
00022 #define GRISNBR 8
00023 #define GCPIECENOR  GRISNBR
00024 #define GCPIECEHI   GRISNBR+1
00025 #define GCPIECEBG   GRISNBR+2
00026 #define GCPIECEHLP  GRISNBR+3
00027 #define GCPETITEFG  GRISNBR+4
00028 #define GCPETITEBG  GRISNBR+5
00029 #define GCPETITECHK GRISNBR+6
00030 #define GCPETITEHLP GRISNBR+7
00031 
00032 #define GCPIECELAST   GCPIECEHLP
00033 #define GCPETITEFIRST GCPETITEFG
00034 #define GCNBR GCPETITEHLP+1
00035 
00036 /* gc (couleur ou texture) */
00037 #define PXNBR      3
00038 #define PXSTART    GCPIECENOR
00039 
00040 
00041 typedef enum
00042 {
00043   TAN_PIECENOR=5,
00044   TAN_PIECEHI,
00045   TAN_PETITEFG,
00046   TAN_PETITEHLP
00047 } tanremplis;
00048 
00049 typedef enum
00050 {
00051   TAN_POLYNORMAL=5,
00052   TAN_POLYBACK,
00053   TAN_POLYON,
00054 } tanpolytype;
00055 
00056 /* polygone (uniquement pour le calcul de la floatfig) */
00057 typedef struct _tanpoly {
00058   int pntnbr;
00059   tanpolytype polytype;
00060   int firstpnt;
00061 } tanpoly;
00062 
00063 /* petit (et tiny) triangle */
00064 typedef struct _tansmalltri tantinytri;
00065 typedef struct _tansmalltri {
00066   double posx;
00067   double posy;
00068   int rot;
00069 } tansmalltri;
00070 
00071 /* point */
00072 typedef struct _tanfpnt {
00073   double posx;
00074   double posy;
00075 } tanfpnt;
00076 
00077 /* definition d'une piece */
00078 typedef struct _tanpiecedef {
00079   double handlex;     /* centre de gravite x */
00080   double handley;
00081   int trinbr;         /* nombre de petits triangles */
00082   tansmalltri tri[TRINBRMAX];
00083   int pntnbr;         /* nombre de points du polygone */
00084   tanfpnt pnt[PNTNBRMAX];
00085 } tanpiecedef;
00086 
00087  /* position d'une piece */
00088 typedef struct _tanpiecepos {
00089   int type;
00090   int flipped;
00091   double posx;
00092   double posy;
00093   int rot;
00094 } tanpiecepos;
00095 
00096 /* figure (jeu de pieces) */
00097 typedef struct _tanfigure {
00098   double zoom;           /* non utilise */
00099   double distmax;        /* en principe ==1.0 */
00100   int drotmax;           /* non utilise */
00101   gboolean reussi;
00102   tanpiecepos piecepos[PIECENBR];
00103 } tanfigure;
00104 
00105 /* flpiece */
00106 typedef struct _tanflpiece {
00107   int flpntnbr;
00108   tanpolytype polytype;
00109   tanfpnt *flpnts;
00110 } tanflpiece;
00111 
00112 /* flfig */
00113 typedef struct _tanflfig {
00114   tanfigure *figure;
00115   int flpiecenbr;
00116   tanflpiece flpieces[PIECENBR];
00117 } tanflfig;
00118 
00119 
00120 
00121 extern GtkWidget *mainwindow;
00122 extern GtkWidget *widgetgrande;        /* widget de la grande drawarea */
00123 extern GtkWidget *widgetpetite;        /* widget de la petite drawarea */
00124 extern GtkStatusbar *widgetstat;       /* widget de la statusbar */
00125 extern GtkSpinButton *spinner;
00126 
00127 extern gint statconid;                 /* context id de la statusbar */
00128 extern GdkRectangle selbackrect;       /* rectangle a redessiner pour effacer la piece selected */
00129 
00130 extern GdkPixmap *pixmapgrande1,*pixmapgrande2;
00131 extern GdkPixmap *pixmappetite;
00132 extern GdkPixmap *pixmappiece1,*pixmappiece2,*pixmapfond;
00133 
00134 extern GtkWidget *colselwin,*filselwin;
00135 
00136 
00137 extern tanpiecedef piecesdef[];
00138 
00139 extern tanfigure figuredebut;
00140 
00141 extern tanfigure *figtab;
00142 extern int figtabsize;
00143 extern int figactualnr;
00144 extern char *figfilename;
00145 
00146 extern tantinytri tinytabpe[TINYNBR],tinytabgr[TINYNBR];
00147 extern tanfigure figgrande,figpetite;
00148 extern int selectedgrande;
00149 extern int xact,yact,xoth,yoth,xold,yold;
00150 extern int actiongrande;
00151 extern int selpossible;
00152 extern int rotact,rotnew,rotold;
00153 
00154 extern int rotstepnbr;            /* nb. de pas de rotation */
00155 extern int initcbgr,initcbpe;     /* init cb deja appellee ? */
00156 
00157 extern GdkGC *invertgc;
00158 extern int invx2,invy2;
00159 
00160 extern GdkGC *tabgc[GCNBR];
00161 extern GdkColor colortab[GCNBR];
00162 extern GdkPixmap **tabpxpx;
00163 extern char **tabpxnam;
00164 
00165 extern gboolean helpoutset;
00166 extern gboolean helptanset;
00167 extern int accuracy;
00168 
00169 extern gboolean editmode;
00170 
00171 
00172 void     tanclampgrandefig (void);
00173 void     tanrecentreout(double oldzoom, double newzoom);
00174 void     tanclearreussinr (int fignr);
00175 void     tansetreussiactual (void);
00176 void     tanreleaseifrot (void);
00177 int      tanangle (double dx, double dy);
00178 void     spesavefig (void);
00179 void     tanend(void);
00180 gboolean tanloadfigtab (char *name);
00181 gboolean tansetpixmapmode(GtkWidget *widget, char *aname, int gcnbr);
00182 void     tansetcolormode(GdkColor *acolor, int gcnbr);
00183 void     tanredrawgrande (void);
00184 void     tanredrawpetite (void);
00185 gboolean tansaveconfig (void);
00186 void     taninitcbgr(void);
00187 void     taninitcbpe(void);
00188 int      tanwichisselect(int x, int y);
00189 void     tansetnewfigurepart2(void);
00190 void     tansetnewfigurepart1(int nrfig);
00191 void     tanunselect (void);
00192 void     tandrawselect(int dx, int dy, int drot);
00193 void     taninitselect(int selected, gboolean necessaire);
00194 void     tantranstinytab (tantinytri *tinys);
00195 void     tanmaketinytabnotr (tanfigure *figure, tantinytri *tinys);
00196 gboolean tantinytabcompare (tantinytri *tinys1, tantinytri *tinys2, int accuracy);
00197 void     tancolle (tanfigure *figure, double seuil);
00198 void     tanstatprov (gchar *msg);
00199 void     tanstatpop (void);
00200 void     tanstatpush (gchar *msg);
00201 void     change_figure(gboolean next);
00202 
00203 
00204 
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214