Miscalculation when drawing rectangles with AndroidGraphics.drawRect() (ch06-mrnom)
Opened this issue · 0 comments
GoogleCodeExporter commented
In the com.badlogic.androidgames.framework.impl.AndroidGraphics:
http://beginning-android-games.googlecode.com/svn/trunk/ch06-mrnom/src/com/badlo
gic/androidgames/framework/impl/AndroidGraphics.java
the method drawrect() is like this:
public void drawRect(int x, int y, int width, int height, int color) {
paint.setColor(color);
paint.setStyle(Style.FILL);
canvas.drawRect(x, y, x + width - 1, y + WIDTH - 1, paint);
}
I have put on allcaps the mistake: the call to canvas.drawRect() is using the
witdh parameter when drawing BOTH the width and the height of the rectangle. It
will never draw rectangles of the specified height the user wants.
At first I thought I hadn't copied the method correctly from the web and I was
surprised when I saw the evident mistake.
Original issue reported on code.google.com by Versec...@gmail.com
on 13 Mar 2014 at 11:35