Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void drawObstacleCircle(Obstacle o, Graphics2D g)
- {
- final double OBSTACLE_CENTER_RADIUS = 2.0;
- final double OBSTACLE_RADIUS = o.getRadius(true);
- float scaleToUse = Math.max(0.8f, scale);
- Vector pos = o.getPosition();
- int xPos = (int) (pos.getX() * getBufferedHeightMap().getWidth());
- int yPos = (int) (pos.getY() * getBufferedHeightMap().getHeight());
- Point positionPoint = convertToPanelPoint(new Point(xPos, yPos));
- // Draw the circle where the Obstacle's center is
- Graphics2D g1 = (Graphics2D) g.create();
- g1.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g1.setColor(Color.RED);
- g1.fillOval(positionPoint.x - (int) (OBSTACLE_CENTER_RADIUS * scaleToUse), positionPoint.y - (int) (OBSTACLE_CENTER_RADIUS * scaleToUse), (int) (OBSTACLE_CENTER_RADIUS * 2 * scaleToUse), (int) (OBSTACLE_CENTER_RADIUS * 2 * scaleToUse));
- Color c = Color.RED;
- g1.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 100));
- g1.fillOval(positionPoint.x - (int) (OBSTACLE_RADIUS * scaleToUse), positionPoint.y - (int) (OBSTACLE_RADIUS * scaleToUse), (int) (OBSTACLE_RADIUS * 2 * scaleToUse), (int) (OBSTACLE_RADIUS * 2 * scaleToUse));
- g1.dispose();
- g2.dispose();
- }
Add Comment
Please, Sign In to add comment