home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / FFILLY / Kouza12 / diamond.tfy < prev    next >
Text File  |  1997-01-03  |  797b  |  31 lines

  1. //diamond.tfy DRAWサンプル2
  2. main(){
  3.     int dot,pic,width,height;
  4.     int i,j;
  5.     int x1,y1,x2,y2;
  6.     real rd,r;
  7.     width=640;
  8.     height=480;
  9.     r=200.0;
  10.     rd=3.14159/180.0;
  11.     dot=LoadPic("1pixel.bmp");
  12.     pic=CreatePic(dot,width,height);
  13.     SetLineSize(1);
  14.     SetPaintColor(0xffffff);
  15.     DrawRect(pic,0,0,width,height);
  16.     SetPaintColor(0x000000);
  17.     DrawRect(pic,10,10,width-10,height-10);
  18.     SetPaintColor(0xffffff);
  19.     OpenWin(pic);
  20.     r=StrtoReal(StrInput("半径は?(50~230)"));
  21.     for(i=0;i<=14;i=i+1){
  22.         x1=RealtoInt(Cos(InttoReal(i)*22.5*rd)*r)+width/2;
  23.         y1=RealtoInt(Sin(InttoReal(i)*22.5*rd)*r)+height/2;
  24.         for(j=i+1;j<=15;j=j+1){
  25.             x2=RealtoInt(Cos(InttoReal(j)*22.5*rd)*r)+width/2;
  26.             y2=RealtoInt(Sin(InttoReal(j)*22.5*rd)*r)+height/2;
  27.             DrawLine(pic,x1,y1,x2,y2);
  28.         }
  29.     }
  30.     mes(LBDOWN){}
  31. }