Skip to content

Commit

Permalink
Run FMT
Browse files Browse the repository at this point in the history
  • Loading branch information
connorslade committed Sep 17, 2023
1 parent 00c4864 commit 05b69ee
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 32 deletions.
8 changes: 4 additions & 4 deletions src/main/java/paintingcanvas/canvas/Canvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public class Canvas {
* the fps of the canvas
*/
public static final int fps = 30;
/**
* Sync with drawables: Use when modifying a drawable
*/
public static final Object drawableSync = new Object();
public static Canvas globalInstance;
/**
* the initial size of the Canvas
Expand All @@ -44,10 +48,6 @@ public class Canvas {
* Sync with frame: Notifies on end of frame
*/
protected final Object frameSync = new Object();
/**
* Sync with drawables: Use when modifying a drawable
*/
public static final Object drawableSync = new Object();
/**
* The current frame
*/
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/paintingcanvas/canvas/CanvasOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ public class CanvasOptions {
*/
public Color backgroundColor = Color.WHITE;

public CanvasOptions() {}
public CanvasOptions() {
}
}
18 changes: 9 additions & 9 deletions src/main/java/paintingcanvas/canvas/RenderLifecycle.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

/**
* <p>
* Allows other classes to run code at different points during the rendering process. This is mainly useful for
* extensions / little widgets and things, but I'm sure you can find other uses.
* Allows other classes to run code at different points during the rendering process. This is mainly useful for
* extensions / little widgets and things, but I'm sure you can find other uses.
* </p>
* <p>
* Here's <em>exactly</em> how it works (sort of). First the {@link java.awt.image.BufferedImage image} is created,
* and the background is drawn. Next, {@link RenderLifecycle#preRender(Graphics)} is called, and all the
* {@link paintingcanvas.drawable.Drawable Drawables} get drawn. Then {@link RenderLifecycle#postRender(Graphics)}
* is called, {@link RenderLifecycle#renderStart(Graphics)} is called, and finally, the image is copied over to the
* screen, and {@link RenderLifecycle#renderEnd(Graphics)} is called.
* Here's <em>exactly</em> how it works (sort of). First the {@link java.awt.image.BufferedImage image} is created,
* and the background is drawn. Next, {@link RenderLifecycle#preRender(Graphics)} is called, and all the
* {@link paintingcanvas.drawable.Drawable Drawables} get drawn. Then {@link RenderLifecycle#postRender(Graphics)}
* is called, {@link RenderLifecycle#renderStart(Graphics)} is called, and finally, the image is copied over to the
* screen, and {@link RenderLifecycle#renderEnd(Graphics)} is called.
* </p>
* <p>
* Note that {@code preRender} / {@code postRender} are called on a different graphics context compared to
* {@code renderStart} / {@code renderEnd}.
* Note that {@code preRender} / {@code postRender} are called on a different graphics context compared to
* {@code renderStart} / {@code renderEnd}.
* </p>
*/
public interface RenderLifecycle {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/paintingcanvas/drawable/Drawable.java
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public T setColor(Color color) {
return getThis();
}

/**
/**
* Set the color of the object with a {@link Hue} object.
* <pre>{@code
* Circle o = new Circle(100, 100, 20);
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/paintingcanvas/drawable/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

/**
* <p>
* Draws an image from the specified path.
* Draws an image from the specified path.
* </p>
* <p>
* {@code setColor} and {@code getColor} don't do anything for this drawable as
* it is not a traditional solid color shape
* {@code setColor} and {@code getColor} don't do anything for this drawable as
* it is not a traditional solid color shape
* </p>
*
* <pre>{@code
Expand All @@ -28,8 +28,9 @@ public class Image extends Drawable<Image> {

/**
* Create a new Image element.
* @param x The X-position of the image
* @param y The Y-position of the image
*
* @param x The X-position of the image
* @param y The Y-position of the image
* @param src The path to the image file
*/
public Image(int x, int y, String src) {
Expand All @@ -51,13 +52,14 @@ public Image(int x, int y, String src) {
* Image img = new Image(0, 0, "image.png");
* img.setScale(2.0, 1.0); // the image is now stretched in the x direction
* }</pre>
*
* @param x The multiplier to scale x by
* @param y The multiplier to scale y by
* @return The original object to allow method chaining
*/
public Image setScale(double x, double y) {
this.width = (int)(image.getWidth() * x);
this.height = (int)(image.getHeight() * y);
this.width = (int) (image.getWidth() * x);
this.height = (int) (image.getHeight() * y);
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/paintingcanvas/extensions/InfoDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public class InfoDisplay implements RenderLifecycle {
0f
);
private final Stroke stroke = new BasicStroke(10);
private final Color textColor = Color.BLACK;
private int fontSize = 12;
private Font font = new Font(Font.DIALOG, Font.PLAIN, 12);
private final Color textColor = Color.BLACK;

public InfoDisplay() {
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/paintingcanvas/misc/Hue.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

/**
* <p>
* Colors (besides black and white) are taken from the
* <a href="https://tailwindcss.com/docs/customizing-colors">Tailwind CSS Color Palette</a>.
* Colors (besides black and white) are taken from the
* <a href="https://tailwindcss.com/docs/customizing-colors">Tailwind CSS Color Palette</a>.
* </p>
* <p>
* Not indented to be constructed directly in the public API. Internally, it's only use is
* {@link #getColor(String)}
* Not indented to be constructed directly in the public API. Internally, it's only use is
* {@link #getColor(String)}
* </p>
* <table>
* <caption>{@link Hue} Variants</caption>
Expand Down
1 change: 0 additions & 1 deletion src/test/java/stress_tests/RotateTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package stress_tests;

import paintingcanvas.canvas.Canvas;
import paintingcanvas.drawable.Polygon;
import paintingcanvas.drawable.Triangle;
import paintingcanvas.extensions.FrameCounter;
import paintingcanvas.extensions.InfoDisplay;
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/stress_tests/SyncTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package stress_tests;

import java.awt.*;

import paintingcanvas.canvas.Canvas;
import paintingcanvas.drawable.*;
import paintingcanvas.extensions.*;
import paintingcanvas.drawable.Circle;
import paintingcanvas.drawable.Polygon;
import paintingcanvas.extensions.FrameCounter;
import paintingcanvas.extensions.InfoDisplay;

import java.awt.*;

@SuppressWarnings("unused")
public class SyncTest {
Expand Down

0 comments on commit 05b69ee

Please sign in to comment.