Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>virtual-cardboard</groupId>
<artifactId>nengen</artifactId>
<version>0.0.8</version>
<version>0.0.9</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/common/math/Matrix4f.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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());
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/context/input/Mouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static visuals.constraint.posdim.AbsoluteConstraint.absolute;

import visuals.constraint.box.ConstraintCoordinate;
import visuals.constraint.box.ConstraintPair;

public class Mouse {

Expand All @@ -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) {
Expand Down
28 changes: 12 additions & 16 deletions src/main/java/visuals/constraint/box/ConstraintBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
89 changes: 0 additions & 89 deletions src/main/java/visuals/constraint/box/ConstraintCoordinate.java

This file was deleted.

This file was deleted.

82 changes: 82 additions & 0 deletions src/main/java/visuals/constraint/box/ConstraintPair.java
Original file line number Diff line number Diff line change
@@ -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());
}

}
Loading