示例#1
0
文件: current.c 项目: 10crimes/code
void main() {
  allegrosetup(scrwid,scrhei);
  makesplitpalette(&redtowhitepalette,&greentowhitepalette);
  randomise();
  PPsetup(scrwid,scrhei,4);
  JBmp j=JBmp(scrwid,scrhei);
  j.clear();
  List<Part> ps=List<Part>();
  for (int i=1;i<=numparts/line;i++) {
    newparts(&ps);
  }
  int frame=0;
  do {
    for (int i=1;i<=ps.len;i++) {
      Part *p=ps.p2num(i);
      int sx,sy;
      PPgetscrpos(p->pos,&sx,&sy);
      int sxb,syb;
      PPgetscrpos(p->pos+V3d(p->rad,0,0),&sxb,&syb);
      float rad=sqrt(mysquare(sx-sxb)+mysquare(sy-syb));
      j.filledcirclenodarker(sx,sy,rad,p->outc);
      j.filledcirclenodarker(sx,sy,rad/3,p->inc);
//      j.shadedcirclenodarker(sx,sy,rad,p->inc,p->outc);
    }
    for (int x=0;x<scrwid;x++)
      for (int y=0;y<scrhei;y++) {
        int k=j.bmp[y][x];
        if (k>=128+fade)
          j.bmp[y][x]-=fade;
        else
          if (k<128)
            if (k>=fade)
              j.bmp[y][x]-=fade;
//            j.bmp[y][x]=intchop(k-fade,0,128);
//          j.bmp[y][x]=128+intchop(k-fade-128,0,128);
        if (k>=128 && k<=128+3)
          j.bmp[y][x]=0;
      }
    j.writetoscreen();
    Matrix m,n;
    V3d rotaxis=V3d::rotate(V3d(0,1,0),V3d(0,0,1),pi/4.0*sin(2*pi*frame/2000));
    m.makerotation(rotaxis,pi/1000.0);
    n.makerotation(rotaxis,-pi/1000.0);
    for (int i=1;i<=ps.len;i++) {
      Part *p=ps.p2num(i);
      if (p->sgn>0)
        p->pos=m*p->pos;
      else
        p->pos=n*p->pos;
      p->pos=p->pos+V3d(0,0,-0.03);
      if ((p->pos.z<-4 || max(myabs(p->pos.x),myabs(p->pos.y))>2)) {
        ps.removenum(i);
        if (ps.len<numparts-line)
          newparts(&ps);
      }
    }
    frame++;
  } while (!key[KEY_ESC]);
}
示例#2
0
文件: main.c 项目: interfector/llxcc
/* Creates and initializes the various parts of the object file.
 */
static int
createparts(blueprint const *bp)
{
    newparts(bp);

    if (bp->parts[P_HASH].shtype)
        bp->parts[P_HASH].link = &bp->parts[P_DYNSYM];

    if (bp->parts[P_DYNSYM].shtype)
        bp->parts[P_DYNSYM].link = &bp->parts[P_DYNSTR];

    if (bp->parts[P_REL].shtype)
    {
        bp->parts[P_REL].link = &bp->parts[P_SYMTAB];
        bp->parts[P_REL].info = P_TEXT;
    }

    if (bp->parts[P_SYMTAB].shtype)
        bp->parts[P_SYMTAB].link = &bp->parts[P_STRTAB];

    if (bp->parts[P_SHDRTAB].shtype && bp->parts[P_SHSTRTAB].shtype)
        bp->parts[P_SHDRTAB].link = &bp->parts[P_SHSTRTAB];

    initparts(bp);

    return 1;
}