俄罗斯方块java
{
fullRowNos[fullCount]=rowNo;
fullCount++;
}
}
//System.out.println("In removeRows: fullCount="+fullCount);
for(int i=0;i<fullCount;i++)
{
int rowNo;
rowNo=fullRowNos[i];
for(int j=rowNo;j<iHeightGrid;j++)
{
for(int k=0;k<iWidthGrid;k++)
{
int tmpMode;
tmpMode=aryGrids[j+1][k].getInUse();
aryGrids[j][k].setInUse(tmpMode);
}
}
}
return fullCount;
}
public void calGridToPosition() //计算出各个格子左上角的坐标.
{
//对容器中的20*10个格子进行初始化.
for(int i=0;i<(iHeightGrid+iBufferHeightGrid);i++)
{
for(int j=0;j<iWidthGrid;j++)
{
aryGrids[i][j]=new grid((iHeight+iBufferHeight)/(iHeightGrid+iBufferHeightGrid),iWidth/iWidthGrid,origin.x+j*(iWidth/iWidthGrid),origin.y-i*((iHeight+iBufferHeight)/(iHeightGrid+iBufferHeightGrid)),2,2,0);
}
}
}
public void drawGrids(Graphics g)
{
//显示已经固定的格子.
for(int i=0;i<iHeightGrid;i++)
for(int j=0;j<iWidthGrid ;j++)
aryGrids[i][j].drawGrid(g);
//显示方块.
int[][] rtnRowColNos;
rtnRowColNos=objDiamonds.diamondsPosition();
//System.out.println("in drawGrids: rtnRowColNos.length=" +rtnRowColNos.length);
//for(int i=0;i<rtnRowColNos.length;i++)
//{
// System.out.println("rtnRowColNos["+i+"][0]="+rtnRowColNos[i][0]+","+"rtnRowColNos["+i+"][1]="+rtnRowColNos[i][1]);
//}
for(int i=0;i<rtnRowColNos.length;i++)
if((rtnRowColNos[i][0]!=-1)&&(rtnRowColNos[i][1]!=-1))
if(rtnRowColNos[i][0]<iHeightGrid)
aryGrids[rtnRowColNos[i][0]][rtnRowColNos[i][1]].drawDiamonds(g); //rtnRowColNos[i][0]是行号,rtnRowColNos[i][1]是列号.
}
public void drawGridFrame(Graphics g)
{
//画各个格子之间的分割线
g.setColor(Color.lightGray);
//画格子的竖分隔线
for(int i=1;i<iWidthGrid;i++)
{
g.drawLine(origin.x+i*(iWidth/iWidthGrid),origin.y,origin.x+i*(iWidth/iWidthGri
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库俄罗斯方块java(10)在线全文阅读。
相关推荐: