Skip to content

Commit

Permalink
Removed PhysicalObject passed to paintPhysicalObject
Browse files Browse the repository at this point in the history
  • Loading branch information
brolund committed Feb 20, 2011
1 parent ac35437 commit ee24a88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions example3/java/space/src/main/java/space/PhysicalObject.java
Expand Up @@ -106,23 +106,23 @@ public String toString() {
+ mass + ",radius=" + radius;
}

public void paintPhysicalObject(Graphics2D graphics, PhysicalObject po) {
public void paintPhysicalObject(Graphics2D graphics) {
if(!Space.IS_BOUNCING_BALLS) {
graphics.setColor(Space.weightToColor(po.mass));
graphics.setColor(Space.weightToColor(mass));
graphics.fillOval(
(int) ((po.x - Space.centrex) / Space.scale + Space.frame.getSize().width / 2),
(int) ((po.y - Space.centrey) / Space.scale + Space.frame.getSize().height / 2),
po.mass>=1e29?7:2,
po.mass>=1e29?7:2);
(int) ((x - Space.centrex) / Space.scale + Space.frame.getSize().width / 2),
(int) ((y - Space.centrey) / Space.scale + Space.frame.getSize().height / 2),
mass>=1e29?7:2,
mass>=1e29?7:2);
} else { //BREAKOUT
graphics.setColor(Color.WHITE);
int x = (int) ((po.x - Space.centrex) / Space.scale + Space.frame.getSize().width / 2);
int y = (int) ((po.y - Space.centrey) / Space.scale + Space.frame.getSize().height / 2);
int xtmp = (int) ((x - Space.centrex) / Space.scale + Space.frame.getSize().width / 2);
int ytmp = (int) ((y - Space.centrey) / Space.scale + Space.frame.getSize().height / 2);
graphics.fillOval(
(int)(x-po.radius),
(int)(y-po.radius),
(int)(po.radius*2/Space.scale),
(int)(po.radius*2/Space.scale));
(int)(xtmp-radius),
(int)(ytmp-radius),
(int)(radius*2/Space.scale),
(int)(radius*2/Space.scale));
}
}
}
2 changes: 1 addition & 1 deletion example3/java/space/src/main/java/space/Space.java
Expand Up @@ -56,7 +56,7 @@ public void paint(Graphics original) {
graphics.clearRect(0, 0, getWidth(), getHeight());
}
for (PhysicalObject po : objects) {
po.paintPhysicalObject(graphics, po);
po.paintPhysicalObject(graphics);
String string = "Objects:" + objects.size() + " scale:" + scale + " steps:" + step;
setTitle(string);
}
Expand Down

0 comments on commit ee24a88

Please sign in to comment.