//dessiner_piece void dessiner_piece(Piece* piece){ Sint16 xs[4],ys[4]; int i=0,color[3],opacity=255; i=0; Point* point=piece->forme->points; while(point!=NULL){ xs[i]=point->x; ys[i]=point->y; i++; point=point->suivant; } switch(piece->id){ case 1:color[0]=88;color[1]=145;color[2]=225;break; case 2:color[0]=200;color[1]=25;color[2]=0;break; case 3:color[0]=150;color[1]=160;color[2]=0;break; case 4:color[0]=251;color[1]=144;color[2]=18;break; case 5:color[0]=118;color[1]=204;color[2]=66;break; case 6:color[0]=71;color[1]=117;color[2]=182;break; case 7:color[0]=255;color[1]=60;color[2]=100;break; } if(piece==piece_mobile){opacity=85;} filledPolygonRGBA(_ecran,xs,ys,i,color[0],color[1],color[2],opacity); aapolygonRGBA(_ecran,xs,ys,i,color[0],color[1],color[2],255); //SDL_Flip(_ecran); }
//dessiner silhouette void dessiner_silhouette(SDL_Surface* sur,Forme* sil){ Forme* forme=sil; while(forme!=NULL){ Sint16 xs[40],ys[40]; int i=0,color[3],opacity=50; i=0; Point* point=forme->points; while(point!=NULL){ xs[i]=point->x; ys[i]=point->y; i++; point=point->suivant; } color[0]=255;color[1]=255;color[2]=255; aapolygonRGBA(_ecran,xs,ys,i,color[0],color[1],color[2],255); filledPolygonRGBA(_ecran,xs,ys,i,color[0],color[1],color[2],opacity); if(forme->formes_vides!=NULL){ Forme* fv=forme->formes_vides; while(fv!=NULL){ i=0; Point* pointv=fv->points; while(pointv!=NULL){ xs[i]=pointv->x; ys[i]=pointv->y; i++; pointv=pointv->suivant; } color[0]=255;color[1]=255;color[2]=255; filledPolygonRGBA(_ecran,xs,ys,i,0,0,0,200); aapolygonRGBA(_ecran,xs,ys,i,color[0],color[1],color[2],255); fv=fv->suivant; } } forme=forme->suivant; } }
void polygonAA(void* s_in, int* xs, int* ys, int n, int r, int g, int b, int a) { SDL_Renderer* s = (SDL_Renderer*)s_in; short u[n]; short v[n]; for (int i = 0; i < n ; i++) { u[i] = xs[i]; v[i] = ys[i]; } free(xs); free(ys); aapolygonRGBA(s, u, v, n, r, g, b, a); }