Restructured the project for a release
Moved to javaecs, compiled via maven Added changes to readme
This commit is contained in:
parent
8ffe1db4af
commit
d66c23fcb3
21
.vscode/launch.json
vendored
Normal file
21
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Launch Current File",
|
||||
"request": "launch",
|
||||
"mainClass": "${file}"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Launch App",
|
||||
"request": "launch",
|
||||
"mainClass": "nz.ac.massey.programming_project_159333_s1_2021.App",
|
||||
"projectName": "javaecs"
|
||||
}
|
||||
]
|
||||
}
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "automatic"
|
||||
}
|
@ -1 +1,4 @@
|
||||
# JavaECS
|
||||
An implementation of an Entity-Component-System in Java. Based on the C++ implementation by [Austin Morlan](https://code.austinmorlan.com/austin/ecs).
|
||||
|
||||
See the [documentation](https://git.software.kauripeak.co.nz/BrychanD/JavaECS-Docs/wiki) for implmentation details
|
||||
|
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>nz.ac.massey.programming_project_159333_s1_2021</groupId>
|
||||
<artifactId>javaecs</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
@ -38,6 +38,28 @@
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
@ -58,7 +80,7 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!-- <plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>${maven-checkstyle-plugin.version}</version>
|
||||
@ -88,7 +110,7 @@
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugin> -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
@ -112,7 +134,7 @@
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- <execution>
|
||||
<id>check-unit-test</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
@ -158,7 +180,7 @@
|
||||
</rule>
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</execution> -->
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
@ -65,25 +65,27 @@ public final class App {
|
||||
|
||||
boolean quit = false;
|
||||
long loopStart = System.currentTimeMillis();
|
||||
long startTime = System.nanoTime();
|
||||
// One potential way to do this
|
||||
while (!quit){
|
||||
// Get the time between frames for accurate time-based calculations (i.e. physics systems etc)
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
frameRateSystem.update(dt, idleTime);
|
||||
physicsSystem.update(dt);
|
||||
logVec2DSystem.update(dt);
|
||||
dt = (System.nanoTime() - startTime) / 1e9; // convert nanoseconds to seconds
|
||||
|
||||
startTime = System.nanoTime();
|
||||
// Limit frame rate (approximately) to minimum of 16 ms
|
||||
if (dt < frameRate){
|
||||
idleTime = frameRate-dt;
|
||||
Thread.sleep((int)((frameRate-dt)*1000));
|
||||
dt = (System.nanoTime() - startTime) / 1e9;
|
||||
startTime = System.nanoTime();
|
||||
}
|
||||
if (System.currentTimeMillis() - loopStart >= 1000){
|
||||
loopStart = System.currentTimeMillis();
|
||||
System.out.println("Second Elapsed");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
/**
|
||||
* Component Array
|
||||
* Defines the data structure that component data is stored under.
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
/**
|
||||
* Component Manager
|
||||
* This class manages component registrations, and adding,
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
/**
|
||||
* ECS manager class.
|
||||
* Call this class and its functions to interact correctly with the ECS system.
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
/**
|
||||
* ECS System class
|
||||
* This class stores entity-system registrations. These are
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
/**
|
||||
* Entity Manager
|
||||
* This class manages entity allocations; keeping a list
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
|
||||
public class FrameRateSystem extends ECSSystem{
|
||||
void init() {}
|
@ -1,9 +1,9 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
|
||||
public class Gravity {
|
||||
public Gravity(){
|
||||
|
||||
}
|
||||
|
||||
public Gravity(double x, double y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@ -15,7 +15,7 @@ public class Gravity {
|
||||
this.terminalY = terminalY;
|
||||
}
|
||||
double x = 0.0;
|
||||
double y = -9.80665;
|
||||
double y = -9.80665; // Force of gravity (from https://www.bipm.org/en/publications/si-brochure - 9th edition - p159 - Bureau International des Poids et Mesures - CC BY 4.0)
|
||||
// Gravity won't be considered if the velocity exceeds this (absolute value). Negative values are ignored (not limited)
|
||||
double terminalX = -1.0;
|
||||
double terminalY = -1.0;
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
|
||||
public class LogVec2DSystem extends ECSSystem{
|
||||
ECS gameEngine;
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
|
||||
public class PhysicsSystem extends ECSSystem{
|
||||
ECS gameEngine;
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
|
||||
public class RidgidBody {
|
||||
public RidgidBody(){}
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
/**
|
||||
* System Manager
|
||||
* This class manages systems registrations, and keeps a current list
|
@ -1,4 +1,4 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
|
||||
public class Vec2D {
|
||||
public Vec2D(){}
|
@ -1,7 +1,8 @@
|
||||
package nz.ac.massey.programming_project_159333_s1_2021;
|
||||
package nz.ac.massey.javaecs;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
@ -9,7 +10,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
/**
|
Loading…
x
Reference in New Issue
Block a user