int currentX=maze.getCurrentX(),currentY=maze.geCurrentY();//划球
canvas.drawCircle((currentX * totalCellWidth)+(cellWidth/2), //x of center
(currentY * totalCellHeight)+(cellWidth/2), //y of center
(cellWidth*0.45f), //radius
ball);
//draw the finishing point indicator
canvas.drawText("F",
(mazeFinishX * totalCellWidth)+(cellWidth*0.25f),
(mazeFinishY * totalCellHeight)+(cellHeight*0.75f),
ball);
}
您必须将png添加到drawable
文件夹中。则可以使用CCD_ 3创建CCD_。位图可以使用canvas.drawBitmap(Bitmap bmp, Rect source, Rect dest, Paint p)
在画布上绘制。bmp
是要绘制的位图,显然,source
是要绘制位图的一部分(在您的情况下是整个位图),dest
是画布上绘制位图的位置,p
是油漆,您不需要,所以只需使用null
。