drawing tiles to the canvas

Problems with Canvas, OpenGL, etc...

drawing tiles to the canvas

Postby ScaryGuy » Sun Jul 11, 2010 8:31 am

Hey there,

I am trying to draw from a tile set to the canvas. My test tile set is 1080 pixels wide. The width of the canvas is 320. When I tell it to draw, I start from (0,0), drawing tiles that are 10x10, and I tell it to stop drawing in the X direction when we hit the canvas width, which is 320.

Theoretically, this should be displaying only 320 pixels, or 32 tiles, of the tile set...but somehow its displaying the entire width of the tile set, just scaled down. Any one have any ideas?
Code: Select all
                           Rect src = new Rect(srcX,srcY,srcX+srcW,srcY+srcH);
                          Rect dst = new Rect(dstX,dstY,dstX+dstW,dstY+dstH);
                           c.drawBitmap(mBackgroundImage, src, dst, null);
                          if(srcX >= mCanvasWidth)
                          //if(i >= 32)
                          if(srcY >= mCanvasHeight)
                          Log.d(TAG, "srcY = " + srcY + " CanvasHeight = " + mCanvasWidth);

Thanks in advance.
Posts: 4
Joined: Fri Jul 09, 2010 3:25 am


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 1 guest