diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..d38ba62
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,34 @@
+name: Create Release
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Set up JDK
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'adopt'
+ java-version: '11'
+
+ - name: Build with Maven
+ run: mvn clean install
+
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tag_name: ${{ github.sha }}
+ release_name: Release ${{ github.sha }}
+ draft: false
+ prerelease: false
diff --git a/README.md b/README.md
index c1bb5c7..37052bc 100644
--- a/README.md
+++ b/README.md
@@ -4,3 +4,7 @@ The 4th iteration of virtual cardboard's Java game engine. This LWJGL-based engi
## Automatic Deployment to GitHub Packages
This project is configured to automatically deploy to GitHub Packages using GitHub Actions on each commit to the `main` branch. No manual deployment steps are required.
+
+## Automatic Release Creation
+
+This project is configured to automatically create a new release using GitHub Actions on each commit to the `main` branch. No manual release steps are required.
diff --git a/pom.xml b/pom.xml
index 01ce5ac..12e0c6c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
virtual-cardboard
nengen
- 0.0.8
+ 0.0.9
1.8
diff --git a/src/main/java/common/math/Matrix4f.java b/src/main/java/common/math/Matrix4f.java
index 672e1c4..1e5fb54 100644
--- a/src/main/java/common/math/Matrix4f.java
+++ b/src/main/java/common/math/Matrix4f.java
@@ -16,7 +16,7 @@
import java.nio.FloatBuffer;
import visuals.constraint.box.ConstraintBox;
-import visuals.constraint.box.ConstraintCoordinate;
+import visuals.constraint.box.ConstraintPair;
import visuals.lwjgl.GLContext;
/**
@@ -51,7 +51,7 @@ public Matrix4f(ConstraintBox box, GLContext glContext) {
this(box.x().get(), box.y().get(), box.w().get(), box.h().get(), glContext);
}
- public Matrix4f(ConstraintCoordinate coord, GLContext glContext) {
+ public Matrix4f(ConstraintPair coord, GLContext glContext) {
this(coord.x().get(), coord.y().get(), 1, 1, glContext);
}
@@ -872,7 +872,7 @@ public static Matrix4f screenToPixel(GLContext glContext) {
.scale(1 / glContext.width(), 1 / glContext.height());
}
- public Matrix4f translate(ConstraintCoordinate translate) {
+ public Matrix4f translate(ConstraintPair translate) {
return translate(translate.x().get(), translate.y().get());
}
diff --git a/src/main/java/context/input/Mouse.java b/src/main/java/context/input/Mouse.java
index 5cd55e6..fa16ebb 100644
--- a/src/main/java/context/input/Mouse.java
+++ b/src/main/java/context/input/Mouse.java
@@ -2,7 +2,7 @@
import static visuals.constraint.posdim.AbsoluteConstraint.absolute;
-import visuals.constraint.box.ConstraintCoordinate;
+import visuals.constraint.box.ConstraintPair;
public class Mouse {
@@ -17,8 +17,8 @@ public int y() {
return y;
}
- public ConstraintCoordinate coordinate() {
- return new ConstraintCoordinate(absolute(x), absolute(y));
+ public ConstraintPair coordinate() {
+ return new ConstraintPair(absolute(x), absolute(y));
}
public void x(int x) {
diff --git a/src/main/java/visuals/constraint/box/ConstraintBox.java b/src/main/java/visuals/constraint/box/ConstraintBox.java
index 5e7d4d0..c55f04a 100644
--- a/src/main/java/visuals/constraint/box/ConstraintBox.java
+++ b/src/main/java/visuals/constraint/box/ConstraintBox.java
@@ -16,19 +16,19 @@ public ConstraintBox(Constraint x, Constraint y, Constraint w, Constraint h) {
this.h = h;
}
- public ConstraintBox(ConstraintCoordinate coordinate, ConstraintSize size) {
- this(coordinate.x(), coordinate.y(), size.w(), size.h());
+ public ConstraintBox(ConstraintPair coordinate, ConstraintPair size) {
+ this(coordinate.x(), coordinate.y(), size.x(), size.y());
}
- public ConstraintBox(Constraint x, Constraint y, ConstraintSize size) {
- this(x, y, size.w(), size.h());
+ public ConstraintBox(Constraint x, Constraint y, ConstraintPair size) {
+ this(x, y, size.x(), size.y());
}
- public ConstraintBox(ConstraintCoordinate coordinate, Constraint w, Constraint h) {
+ public ConstraintBox(ConstraintPair coordinate, Constraint w, Constraint h) {
this(coordinate.x(), coordinate.y(), w, h);
}
- public ConstraintBoxValue value() {
+ public ConstraintBoxValue get() {
return new ConstraintBoxValue(x.get(), y.get(), w.get(), h.get());
}
@@ -48,8 +48,8 @@ public Constraint h() {
return h;
}
- public boolean contains(ConstraintCoordinate coordinate) {
- return contains(coordinate.value().toVector());
+ public boolean contains(ConstraintPair coordinate) {
+ return contains(coordinate.vector());
}
public boolean contains(Vector2f point) {
@@ -65,16 +65,12 @@ public ConstraintLine vertical() {
return new ConstraintLine(y, h);
}
- public ConstraintCoordinate coordinate() {
- return new ConstraintCoordinate(x, y);
+ public ConstraintPair coordinate() {
+ return new ConstraintPair(x, y);
}
- public ConstraintSize dimensions() {
- return new ConstraintSize(w, h);
- }
-
- public ConstraintSize size() {
- return new ConstraintSize(w, h);
+ public ConstraintPair dimensions() {
+ return new ConstraintPair(w, h);
}
public ConstraintBox translate(Constraint x, Constraint y) {
diff --git a/src/main/java/visuals/constraint/box/ConstraintCoordinate.java b/src/main/java/visuals/constraint/box/ConstraintCoordinate.java
deleted file mode 100644
index fdd8ab0..0000000
--- a/src/main/java/visuals/constraint/box/ConstraintCoordinate.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package visuals.constraint.box;
-
-import static visuals.constraint.posdim.AbsoluteConstraint.absolute;
-
-import common.math.Vector2f;
-import visuals.constraint.Constraint;
-
-public class ConstraintCoordinate {
-
- private final Constraint x;
- private final Constraint y;
-
- public ConstraintCoordinate(Constraint x, Constraint y) {
- this.x = x;
- this.y = y;
- }
-
- public ConstraintCoordinateValue value() {
- return new ConstraintCoordinateValue(x.get(), y.get());
- }
-
- public Constraint x() {
- return x;
- }
-
- public Constraint y() {
- return y;
- }
-
- public ConstraintCoordinate invert() {
- return new ConstraintCoordinate(x.multiply(-1), y.multiply(-1));
- }
-
- public ConstraintCoordinate translate(ConstraintSize size) {
- return new ConstraintCoordinate(this.x.add(size.w()), this.y.add(size.h()));
- }
-
- public ConstraintCoordinate translate(Constraint x, Constraint y) {
- return new ConstraintCoordinate(this.x.add(x), this.y.add(y));
- }
-
- @Deprecated
- public ConstraintCoordinate translate(float x, float y) {
- return translate(absolute(x), absolute(y));
- }
-
- @Deprecated
- public ConstraintCoordinate translate(Vector2f v) {
- return translate(v.x(), v.y());
- }
-
- @Deprecated
- public ConstraintCoordinate translate(ConstraintCoordinate c) {
- return translate(c.x, c.y);
- }
-
- public ConstraintCoordinate subtract(ConstraintCoordinate c) {
- return translate(c.invert());
- }
-
- public ConstraintCoordinate subtract(Vector2f v) {
- return translate(v.negate());
- }
-
- public ConstraintSize scale(float f) {
- return scale(f, f);
- }
-
- public ConstraintSize scale(float f1, float f2) {
- return new ConstraintSize(x.multiply(f1), x.multiply(f2));
- }
-
- public ConstraintSize add(ConstraintSize other) {
- return add(other.w(), other.h());
- }
-
- public ConstraintSize add(Vector2f v) {
- return add(absolute(v.x()), absolute(v.y()));
- }
-
- public ConstraintSize add(Constraint cw, Constraint ch) {
- return new ConstraintSize(x.add(cw), x.add(ch));
- }
-
- public ConstraintCoordinate neg() {
- return new ConstraintCoordinate(x.neg(), y.neg());
- }
-
-}
diff --git a/src/main/java/visuals/constraint/box/ConstraintCoordinateValue.java b/src/main/java/visuals/constraint/box/ConstraintCoordinateValue.java
deleted file mode 100644
index 34c132a..0000000
--- a/src/main/java/visuals/constraint/box/ConstraintCoordinateValue.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package visuals.constraint.box;
-
-import common.math.Vector2f;
-
-/**
- * {@link ConstraintCoordinateValue} objects are temporary and are used to store the values of a
- * {@link ConstraintCoordinate} at a given time
- */
-public class ConstraintCoordinateValue {
-
- private final float x;
- private final float y;
-
- /**
- * Creates a new {@link ConstraintCoordinateValue} with the given values
- *
- * @param x the x value
- * @param y the y value
- */
- public ConstraintCoordinateValue(float x, float y) {
- this.x = x;
- this.y = y;
- }
-
- /**
- * @return the x value
- */
- public float x() {
- return x;
- }
-
- /**
- * @return the y value
- */
- public float y() {
- return y;
- }
-
- public Vector2f toVector() {
- return new Vector2f(x, y);
- }
-
-}
diff --git a/src/main/java/visuals/constraint/box/ConstraintPair.java b/src/main/java/visuals/constraint/box/ConstraintPair.java
new file mode 100644
index 0000000..f463ed1
--- /dev/null
+++ b/src/main/java/visuals/constraint/box/ConstraintPair.java
@@ -0,0 +1,82 @@
+package visuals.constraint.box;
+
+import static visuals.constraint.posdim.AbsoluteConstraint.absolute;
+
+import common.math.Vector2f;
+import visuals.constraint.Constraint;
+
+public class ConstraintPair {
+
+ protected final Constraint x;
+ protected final Constraint y;
+
+ public ConstraintPair(Constraint x, Constraint y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public ConstraintPair(Vector2f absolute) {
+ this(absolute(absolute.x()), absolute(absolute.y()));
+ }
+
+ /**
+ * Calculates the value of this {@link ConstraintPair} at a given time and returns it in a {@link Vector2f}.
+ * @return The value of this {@link ConstraintPair} as a {@link Vector2f}
+ */
+ public Vector2f vector() {
+ return new Vector2f(x.get(), y.get());
+ }
+
+ public Constraint x() {
+ return x;
+ }
+
+ public Constraint y() {
+ return y;
+ }
+
+ public ConstraintPair scale(float f) {
+ return scale(f, f);
+ }
+
+ public ConstraintPair scale(float f1, float f2) {
+ return new ConstraintPair(x.multiply(f1), y.multiply(f2));
+ }
+
+ public ConstraintPair add(float x, float y) {
+ return add(absolute(x), absolute(y));
+ }
+
+ public ConstraintPair add(Vector2f vector) {
+ return add(vector.x(), vector.y());
+ }
+
+ public ConstraintPair add(ConstraintPair other) {
+ return add(other.x(), other.y());
+ }
+
+ public ConstraintPair add(Constraint cx, Constraint cy) {
+ return new ConstraintPair(x.add(cx), y.add(cy));
+ }
+
+ public ConstraintPair neg() {
+ return new ConstraintPair(x.neg(), y.neg());
+ }
+
+ public ConstraintPair sub(Vector2f vector) {
+ return sub(vector.x(), vector.y());
+ }
+
+ public ConstraintPair sub(float x, float y) {
+ return sub(absolute(x), absolute(y));
+ }
+
+ public ConstraintPair sub(ConstraintPair other) {
+ return sub(other.x(), other.y());
+ }
+
+ public ConstraintPair sub(Constraint cx, Constraint cy) {
+ return add(cx.neg(), cy.neg());
+ }
+
+}
diff --git a/src/main/java/visuals/constraint/box/ConstraintSize.java b/src/main/java/visuals/constraint/box/ConstraintSize.java
deleted file mode 100644
index d43bfa9..0000000
--- a/src/main/java/visuals/constraint/box/ConstraintSize.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package visuals.constraint.box;
-
-import static visuals.constraint.posdim.AbsoluteConstraint.absolute;
-
-import common.math.Vector2f;
-import visuals.constraint.Constraint;
-
-public class ConstraintSize {
-
- private final Constraint w;
- private final Constraint h;
-
- public ConstraintSize(Constraint w, Constraint h) {
- this.w = w;
- this.h = h;
- }
-
- public ConstraintSize(Vector2f dimensions) {
- this(absolute(dimensions.x()), absolute(dimensions.y()));
- }
-
- public ConstraintSizeValue value() {
- return new ConstraintSizeValue(w.get(), h.get());
- }
-
- public Constraint w() {
- return w;
- }
-
- public Constraint h() {
- return h;
- }
-
- public ConstraintSize scale(float f) {
- return scale(f, f);
- }
-
- public ConstraintSize scale(float f1, float f2) {
- return new ConstraintSize(w.multiply(f1), h.multiply(f2));
- }
-
- public ConstraintSize add(ConstraintSize other) {
- return add(other.w(), other.h());
- }
-
- public ConstraintSize add(Constraint cw, Constraint ch) {
- return new ConstraintSize(w.add(cw), h.add(ch));
- }
-
- public ConstraintSize neg() {
- return new ConstraintSize(w.neg(), h.neg());
- }
-
-}
diff --git a/src/main/java/visuals/constraint/box/ConstraintSizeValue.java b/src/main/java/visuals/constraint/box/ConstraintSizeValue.java
deleted file mode 100644
index ee8f5a2..0000000
--- a/src/main/java/visuals/constraint/box/ConstraintSizeValue.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package visuals.constraint.box;
-
-import common.math.Vector2f;
-
-/**
- * {@link ConstraintSizeValue} objects are temporary and are used to store the values of a {@link ConstraintBox} at a
- * given time
- */
-public class ConstraintSizeValue {
-
- private final float w;
- private final float h;
-
- /**
- * Creates a new {@link ConstraintSizeValue} with the given values
- *
- * @param w the width value
- * @param h the height value
- */
- public ConstraintSizeValue(float w, float h) {
- this.w = w;
- this.h = h;
- }
-
- /**
- * @return the width value
- */
- public float w() {
- return w;
- }
-
- /**
- * @return the height value
- */
- public float h() {
- return h;
- }
-
- public Vector2f toVector() {
- return new Vector2f(w, h);
- }
-
-}