Skip to content
Browse files

Removed PhysicalObject passed to paintPhysicalObject

  • Loading branch information...
1 parent 018dbc7 commit 9ae982b3650e9a42f0069a751aead4d4a00e572f @brolund brolund committed Feb 20, 2011
Showing with 13 additions and 13 deletions.
  1. +12 −12 space/src/main/java/space/PhysicalObject.java
  2. +1 −1 space/src/main/java/space/Space.java
View
24 space/src/main/java/space/PhysicalObject.java
@@ -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));
}
}
}
View
2 space/src/main/java/space/Space.java
@@ -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);
}

0 comments on commit 9ae982b

Please sign in to comment.
Something went wrong with that request. Please try again.