From 21621ca9625d637386a3d030cc57e734a5cab451 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Ko=C5=BEusznik?= <jan@kozusznik.cz>
Date: Mon, 26 Sep 2022 09:13:46 +0200
Subject: [PATCH] Delete classes World and Bullet

---
 src/main/java/lab/Bullet.java        | 34 -------------------------
 src/main/java/lab/DrawingThread.java |  6 ++---
 src/main/java/lab/World.java         | 38 ----------------------------
 3 files changed, 2 insertions(+), 76 deletions(-)
 delete mode 100644 src/main/java/lab/Bullet.java
 delete mode 100644 src/main/java/lab/World.java

diff --git a/src/main/java/lab/Bullet.java b/src/main/java/lab/Bullet.java
deleted file mode 100644
index 6710390..0000000
--- a/src/main/java/lab/Bullet.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package lab;
-
-import javafx.geometry.Point2D;
-import javafx.scene.canvas.GraphicsContext;
-import javafx.scene.paint.Color;
-
-public class Bullet {
-	private World world;
-	private Point2D velocity;
-	private double size;
-	private Point2D position;
-	public Bullet(World world, Point2D startPosition, Point2D velocity, double size) {
-		super();
-		this.world = world;
-		this.velocity = velocity;
-		this.size = size;
-		this.position = startPosition;
-	}
-	
-	public void draw(GraphicsContext gc) {
-		gc.save();
-		gc.setFill(Color.BROWN);
-		Point2D p = world.getCanvasPoint(position);
-			gc.fillOval(p.getX() - size /2, p.getY() - size/2, size, size);
-		gc.restore();
-	}
-
-	public void simulate(double deltaT) {
-		// TODO Auto-generated method stub
-		position = position.add(velocity.multiply(deltaT));
-	}
-	
-	
-}
diff --git a/src/main/java/lab/DrawingThread.java b/src/main/java/lab/DrawingThread.java
index 4a7519f..f2436cd 100644
--- a/src/main/java/lab/DrawingThread.java
+++ b/src/main/java/lab/DrawingThread.java
@@ -7,12 +7,10 @@ import javafx.scene.canvas.GraphicsContext;
 public class DrawingThread extends AnimationTimer {
 
 	private final GraphicsContext gc;
-	private final World world;
 	private long lastTime;
 
 	public DrawingThread(Canvas canvas) {
 		this.gc = canvas.getGraphicsContext2D();
-		this.world = new World(canvas.getWidth(), canvas.getHeight());
 	}
 
 	/**
@@ -22,9 +20,9 @@ public class DrawingThread extends AnimationTimer {
 	public void handle(long now) {
 		if (lastTime > 0) {
 			double deltaT = (now - lastTime) / 1e9;
-			world.simulate(deltaT);
+			// call simulate on world
 		}
-		world.draw(gc);
+		//call draw on world
 		lastTime= now;
 
 	}
diff --git a/src/main/java/lab/World.java b/src/main/java/lab/World.java
deleted file mode 100644
index 8cef4e9..0000000
--- a/src/main/java/lab/World.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package lab;
-
-import javafx.geometry.Point2D;
-import javafx.scene.canvas.GraphicsContext;
-import javafx.scene.paint.Color;
-
-public class World {
-	
-	private double width;
-	
-	private double height;
-
-	private Bullet bullet;
-
-	
-	public World(double width, double height) {
-		this.width = width;
-		this.height = height;
-		this.bullet = new Bullet(this, new Point2D(10, 10), new Point2D(10, 30), 15);
-	}
-	
-	public Point2D getCanvasPoint(Point2D in) {
-		Point2D result = new Point2D(in.getX(), height - in.getY());
-		return result;
-	}
-	
-	public void draw(GraphicsContext gc) {
-		gc.save();
-		gc.setFill(Color.LIGHTGREY);
-		gc.fillRect(0, 0, width, height);
-		gc.restore();
-		bullet.draw(gc);
-	}
-	
-	public void simulate(double deltaT) {
-		this.bullet.simulate(deltaT);
-	}
-}
-- 
GitLab