Add Project Lombok to remove all getters and setters.
This commit is contained in:
parent
51218fd182
commit
34b9ac0d05
4 changed files with 26 additions and 71 deletions
7
pom.xml
7
pom.xml
|
@ -405,6 +405,13 @@
|
|||
<artifactId>joml</artifactId>
|
||||
<version>${joml.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.28</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -2,12 +2,13 @@ package com.okseby.core;
|
|||
|
||||
import com.okseby.core.test.TestGame;
|
||||
import com.okseby.core.utils.Constants;
|
||||
import lombok.Getter;
|
||||
import org.lwjgl.Version;
|
||||
|
||||
public class Launcher {
|
||||
|
||||
private static WindowManager window;
|
||||
private static TestGame game;
|
||||
@Getter private static WindowManager window;
|
||||
@Getter private static TestGame game;
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("LWJGL Version: " + Version.getVersion());
|
||||
|
@ -23,12 +24,4 @@ public class Launcher {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static WindowManager getWindow() {
|
||||
return window;
|
||||
}
|
||||
|
||||
public static TestGame getGame() {
|
||||
return game;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.okseby.core;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWErrorCallback;
|
||||
|
@ -13,20 +15,17 @@ public class WindowManager {
|
|||
public static final float Z_NEAR = 0.01f;
|
||||
public static final float Z_FAR = 1000f;
|
||||
|
||||
private String title;
|
||||
@Getter private long window;
|
||||
@Getter private int width, height;
|
||||
@Getter @Setter private String title;
|
||||
@Getter @Setter private boolean resizeable, vsync;
|
||||
@Getter private final Matrix4f projectionMatrix;
|
||||
|
||||
private int width, height;
|
||||
private long window;
|
||||
|
||||
private boolean resizeable, vSync;
|
||||
|
||||
private final Matrix4f projectionMatrix;
|
||||
|
||||
public WindowManager(String title, int width, int height, boolean vSync) {
|
||||
public WindowManager(String title, int width, int height, boolean vsync) {
|
||||
this.title = title;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.vSync = vSync;
|
||||
this.vsync = vsync;
|
||||
|
||||
projectionMatrix = new Matrix4f();
|
||||
}
|
||||
|
@ -73,12 +72,14 @@ public class WindowManager {
|
|||
GLFW.glfwMaximizeWindow(window);
|
||||
else {
|
||||
GLFWVidMode vidMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
|
||||
|
||||
assert vidMode != null;
|
||||
GLFW.glfwSetWindowPos(window, (vidMode.width() - width) / 2, (vidMode.height() - height) / 2);
|
||||
}
|
||||
|
||||
GLFW.glfwMakeContextCurrent(window);
|
||||
|
||||
if (isvSync())
|
||||
if (isVsync())
|
||||
GLFW.glfwSwapInterval(1);
|
||||
|
||||
GLFW.glfwShowWindow(window);
|
||||
|
@ -113,46 +114,6 @@ public class WindowManager {
|
|||
return GLFW.glfwWindowShouldClose(window);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
GLFW.glfwSetWindowTitle(window, title);
|
||||
}
|
||||
|
||||
public boolean isResizeable() {
|
||||
return resizeable;
|
||||
}
|
||||
|
||||
public boolean isvSync() {
|
||||
return vSync;
|
||||
}
|
||||
|
||||
public void setvSync(boolean vSync) {
|
||||
this.vSync = vSync;
|
||||
}
|
||||
|
||||
public void setResizeable(boolean resizeable) {
|
||||
this.resizeable = resizeable;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public long getWindow() {
|
||||
return window;
|
||||
}
|
||||
|
||||
public Matrix4f getProjectionMatrix() {
|
||||
return projectionMatrix;
|
||||
}
|
||||
|
||||
public Matrix4f updateProjectionMatrix() {
|
||||
float aspectRatio = (float) width / height;
|
||||
return projectionMatrix.setPerspective(FOV, aspectRatio, Z_NEAR, Z_FAR);
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
package com.okseby.core.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class Model {
|
||||
private int id;
|
||||
private int vertexCount;
|
||||
@Getter private int id;
|
||||
@Getter private int vertexCount;
|
||||
|
||||
public Model(int id, int vertexCount) {
|
||||
this.id = id;
|
||||
this.vertexCount = vertexCount;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getVertexCount() {
|
||||
return vertexCount;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue