コード例 #1
0
ファイル: EcranX.c プロジェクト: r0llup/SpaceInvaders
int DessineDisque(TC *p,int xc,int yc,int rayon,int couleur,int couleurBord)
{
  int x,y;
  int xmxc2,r2,d2;
  int borne = 7; // arbitraire...

  r2 = rayon*rayon;

  for (x=(xc-rayon) ; x<=(xc+rayon) ; x++)
  {
    xmxc2 = (x-xc)*(x-xc);
    for (y=(yc-rayon) ; y<=(yc+rayon) ; y++)
    {
      d2 = xmxc2+(y-yc)*(y-yc);
      if (d2 < r2)
      {
        setCouleurCrayon(p,couleur);
        XDrawPoint(p->display,p->win,p->gc,x,y);
      }

      if ((-borne < (d2-r2)) && ((d2-r2) < borne))
      {
        setCouleurCrayon(p,couleurBord);
        XDrawPoint(p->display,p->win,p->gc,x,y);
      } 
    }
  }
    
  XFlush(p->display);

  return 0;
}
コード例 #2
0
ファイル: EcranX.c プロジェクト: RaphaelJ/Cours-2e-annee
int DessinePoint(TC *p,int x,int y,int couleur)
{
  setCouleurCrayon(p,couleur);
  XDrawPoint(p->display,p->win,p->gc,x,y);

  XFlush(p->display);
  return 0;
}
コード例 #3
0
ファイル: EcranX.c プロジェクト: RaphaelJ/Cours-2e-annee
int DessineLigne(TC *p,int x1,int y1,int x2,int y2,int couleur)
{
  setCouleurCrayon(p,couleur);
  XDrawLine(p->display,p->win,p->gc,x1,y1,x2,y2);
  
  XFlush(p->display);
  
  return 0;
}
コード例 #4
0
ファイル: EcranX.c プロジェクト: RaphaelJ/Cours-2e-annee
int DessineRectangle(TC *p,int xg,int yg,int xd,int yd,int couleur,int style)
{
  setCouleurCrayon(p,couleur);
  if (style == CREUX) XDrawRectangle(p->display,p->win,p->gc,xg,yg,(xd-xg),(yd-yg));
  if (style == PLEIN) XFillRectangle(p->display,p->win,p->gc,xg,yg,(1+xd-xg),(1+yd-yg));
  
  XFlush(p->display);

  return 0;
}