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();
          paint.setColor(Color.GRAY);
          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);
          }
          paint.setColor(Color.BLACK);
          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)
             drawWinLine(canvas);
       }   


Here is my full code: http://www.mediafire.com/download.php?25gfjdtdnzm

Please check for me if you have time

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

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests