Graphics 2D Problem

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Graphics 2D Problem

Postby donalduck0304 » Tue Nov 03, 2009 10:06 am

I am trying to do a Gomuko Game on Android. Here is a part from my code to draw the board to play game. I don't know why it's wrong

For each point of board. I use an array (int board[13][13]) to contain it. May be it's wrong in android

Code: Select all
protected void onDraw(Canvas canvas){
          Paint paint = new Paint();
          int width = 300, height = 300;
          for (int i = 1; i < 13; i++){
             canvas.drawLine(1 + 13*i, 0, 1 + 13*i, height, paint);
             canvas.drawLine(0, 1 + 13*i, width, 1 + 13*i, paint);
          canvas.drawRect(0,0,width-1,height-1, paint);
          canvas.drawRect(1,1,width-3,height-3, paint);
          for (int row = 0; row < 13; row++)
             for (int col = 0; col < 13; col++)
                if (board[row][col] != EMPTY)
                   drawPiece(canvas, board[row][col], row, col);
          if (win_r1 >= 0)

Here is my full code:

Please check for me if you have time

Thanks in advance
User avatar
Posts: 6
Joined: Tue Oct 20, 2009 10:38 am


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 15 guests