Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotjarnit committed Jan 19, 2024
1 parent 8b9bd6a commit 3a9ed62
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class RenderingEngine extends JPanel {
private final ElliotEngine engine;
private double lastFrameTime = System.nanoTime();
// Map of pixel location to fowardmost object
private Map<Vector2, EObject> pixelMap = new HashMap<>();
private HashMap<String, EObject> pixelMap = new HashMap<>();
private int fps = 0;
public enum ProjectionMode {
PERSPECTIVE,
Expand Down Expand Up @@ -191,7 +191,7 @@ public void renderFaceInWorld(BufferedImage img, EObject object, double[] zBuffe
if (zBuffer[zIndex] < depth) {
zBuffer[zIndex] = depth;
img.setRGB(x, y, color.toAwtColor().getRGB());
this.pixelMap.put(new Vector2(x, y), object);
this.pixelMap.put(x + "," + y, object);
}
}
}
Expand Down Expand Up @@ -237,7 +237,7 @@ public int getFPS() {
}

public EObject getObjectAtPoint(Vector2 point) {
return this.pixelMap.get(point);
return this.pixelMap.get((int) point.x + "," + (int) point.y);
}

public EObject getObjectLookingAt() {
Expand Down

0 comments on commit 3a9ed62

Please sign in to comment.