I am currently programming a very simple game for Android (API level 7) to open and learn the SDK for Android. This game includes a form of drawing on the screen, which will change color when touched.
Some shapes may insert one or more holes. My problem: if I touch the shape, everything changes, even the holes. "Here is the pseudocode I use, the shape is the polygon I want to draw, it borders on the outer border, it breathes an array of its holes. The hole and the border contain an array of their points .
Path MyPath = Path(); Path.moveTo(boundary.points[0].x, boundary.point[0].x); for (point in boundary) { MyPath.lineTo(point.x, point.y); } Path.close(); for (hole in shape.holes) { MyPath.moveTo(hole.points[0].x,hole.points[0].y); for (point in hole) { MyPath.lineTo(point.x, point.y); } MyPath.close(); }
Is there something I miss about Path in Android, or do you have an alternative way to do this?
source share