安卓课程设计报告
设计题目:五子棋
目录
vas canvas=();
//获得画笔
Paint paint=new Paint();
//绘画
(true);
Matrix matrix=new Matrix();
int ww = ();// 获取资源位图的宽
int hh = ();//获取资源位图的高
float w = (width/(float)ww);
float h = (float) ((height/(float)hh)/);
(w, h);//获取缩放比例
Bitmap bmp = (bitmap, 0, 0, ww, hh, matrix, true);// 根
据缩放比例获取新的位图
(bmp, 0, 0, paint); //在屏幕上画出位图 int sx=(int) width;
int sy=(int) (height/);
();
//适应屏幕画横线竖线
tempy=(float) ((*sy-(*sy)%8-16)/8);
ax=(sx-tempy*8)/2;
ay=(float) (((*sy)%8)/2)+8;
bx=sx-(sx-tempy*8)/2;
cy=(float) (*sy-((*sy)%8)/2-8);
("MyView:==========="+tempy); for(int i=0;i<9;i++)
{
(ax, ay+tempy*i, bx, ay+tempy*i, paint); (ax+tempy*i, ay, ax+tempy*i, cy, paint);
}
//画棋盘下方现实信息 ();
(30);
float tx=3*sx/8;
float ty=(float) (*sy);
(msg, 3*sx/8-25, (float) (*sy), paint); ("开始 ", (float) (*sx), (float) (*sy), paint); ("认输 ", (float) (*sx), (float) (*sy), paint); ("退出 ", (float) (*sx), (float) (*sy), paint);
//画棋子 int qx,qy;
for(int i=0;i<9;i++)
{
for(int j=0;j<9;j++)
{
//画黑棋 if(chess[i][j]==1)
{
qx=(int) (ax+i*tempy);
qy=(int) (ay+j*tempy);
();
(qx, qy, tempy/3, paint);
}
//画白棋
else if(chess[i][j]==2)
{
qx=(int) (ax+i*tempy);
qy=(int) (ay+j*tempy);
();
(qx, qy, tempy/3, paint);
}
}
}
if(canvas!=null)
{
安卓课程设计报告 来自淘豆网m.daumloan.com转载请标明出处.