当然现在没那能力因为我还在初学阶段,但是我想看看 图形代码的结构.
希望哪位 兄弟帮我做几个 俄罗斯方块形状代码出来我参考下 谢谢了!
主要思路是:每个形状都可以是4个小方块
构成,每个形状都是4个小方块的组合.
void drawSimpleDiamond(int x,int y) /*画一个小方块*/
{
setfillstyle(1,7);
bar(x+1,y+1,x+24,y+24);
setlinestyle(0,0,1);
setcolor(15);
line(x,y,x+24,y);
line(x,y,x,y+24);
setcolor(8);
line(x+25,y,x+25,y+25);
line(x,y+25,x+24,y+25);
}
void stickGraph(int x,int y,int number) /*画横和竖两种形状*/
{
int i;
if(number==1)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x+78,y);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x,y+52);
drawSimpleDiamond(x,y+78);
return ;
}
}
void frameGraph(int x,int y) /*画田字形的方块*/
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x+26,y+26);
return ;
}
void pinGraph(int x,int y,int number) /*画凸字形的4种不同状态的方块*/
{
if(number==1)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x+26,y-26);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x,y+52);
drawSimpleDiamond(x+26,y+26);
return ;
}
else if(number==3)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x+26,y+26);
return ;
}
else if(number==4)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x,y+52);
drawSimpleDiamond(x-26,y+26);
return ;
}
}
void hoeGraph(int x,int y,int number) /*画7字形的4种不同状态的方块*/
{
if(number==1)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x,y+52);
drawSimpleDiamond(x+26,y);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x+52,y+26);
return ;
}
else if(number==3)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+26,y-52);
drawSimpleDiamond(x+26,y-26);
return ;
}
else if(number==4)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x,y-26);
return ;
}
}
/*以下二个函数是画4种不同状态的梯形的函数*/
void stairsGraph1(int x,int y,int number)
{
if(number==1)
{
drawSimpleDiamond(x,y-26);
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+26,y+26);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+26,y-26);
drawSimpleDiamond(x+52,y-26);
return ;
}
}
void stairsGraph2(int x,int y,int number)
{
if(number==1)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x+26,y-26);
drawSimpleDiamond(x+26,y);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+26,y+26);
drawSimpleDiamond(x+52,y+26);
return ;
}
}