This commit is contained in:
2021-09-07 14:16:04 -07:00
parent c78c4f32c1
commit 51da4b5f65
3 changed files with 5 additions and 2 deletions
Vendored
BIN
View File
Binary file not shown.
+3
View File
@@ -21,3 +21,6 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid* hs_err_pid*
# png frames
*.png
+2 -2
View File
@@ -59,14 +59,14 @@ public class Space {
Canvas canvas = new Canvas( (int) this.height, (int) this.width, 255,255,255,255); Canvas canvas = new Canvas( (int) this.height, (int) this.width, 255,255,255,255);
for(int i = 0; i < this.bodies.length; i ++){ for(int i = 0; i < this.bodies.length; i ++){
canvas.drawSquare(5, (int) this.bodies[i].getXpos(), (int) this.bodies[i].getYpos(), 0, 0, 0, 255); canvas.drawSquare(5, (int) this.bodies[i].getXpos(), (int) this.bodies[i].getYpos(), 255, 255, 255, 255);
} }
File f = null; File f = null;
try{ try{
String frameNumberStr = String.valueOf(frameNumber); String frameNumberStr = String.valueOf(frameNumber);
frameNumberStr = frameNumberStr + ".png"; frameNumberStr = frameNumberStr + ".png";
f = new File(frameNumberStr); f = new File("frames/" + frameNumberStr);
ImageIO.write(canvas.image, "png", f); ImageIO.write(canvas.image, "png", f);
}catch(IOException e){ }catch(IOException e){
System.out.println("Error: " + e); System.out.println("Error: " + e);