chore(engine): switch to libGDX
For real
This commit is contained in:
@ -5,6 +5,8 @@
|
|||||||
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/9.0.0/userguide/building_java_projects.html in the Gradle documentation.
|
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/9.0.0/userguide/building_java_projects.html in the Gradle documentation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
val libgdxVersion = "1.13.5"
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
// Apply the application plugin to add support for building a CLI application in Java.
|
// Apply the application plugin to add support for building a CLI application in Java.
|
||||||
application
|
application
|
||||||
@ -29,6 +31,27 @@ dependencies {
|
|||||||
|
|
||||||
// This dependency is used by the application.
|
// This dependency is used by the application.
|
||||||
implementation(libs.guava)
|
implementation(libs.guava)
|
||||||
|
|
||||||
|
// ----- LibGDX Core / Extras -----
|
||||||
|
implementation("com.badlogicgames.gdx:gdx:$libgdxVersion")
|
||||||
|
implementation("com.badlogicgames.gdx:gdx-box2d:$libgdxVersion")
|
||||||
|
implementation("com.badlogicgames.gdx:gdx-freetype:$libgdxVersion")
|
||||||
|
implementation("com.badlogicgames.ashley:ashley:1.7.4")
|
||||||
|
|
||||||
|
// ----- LibGDX Desktop (LWJGL3 + natives) -----
|
||||||
|
implementation("com.badlogicgames.gdx:gdx-backend-lwjgl3:$libgdxVersion")
|
||||||
|
implementation("com.badlogicgames.gdx:gdx-platform:$libgdxVersion:natives-desktop")
|
||||||
|
implementation("com.badlogicgames.gdx:gdx-box2d-platform:$libgdxVersion:natives-desktop")
|
||||||
|
implementation("com.badlogicgames.gdx:gdx-freetype-platform:$libgdxVersion:natives-desktop")
|
||||||
|
|
||||||
|
// Tools (exclude legacy LWJGL backend)
|
||||||
|
implementation("com.badlogicgames.gdx:gdx-tools:$libgdxVersion") {
|
||||||
|
exclude(group = "com.badlogicgames.gdx", module = "gdx-backend-lwjgl")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logging
|
||||||
|
implementation("org.slf4j:slf4j-api:2.1.0-alpha1")
|
||||||
|
implementation("ch.qos.logback:logback-classic:1.5.18")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply a specific Java toolchain to ease working on different environments.
|
// Apply a specific Java toolchain to ease working on different environments.
|
||||||
@ -40,7 +63,12 @@ java {
|
|||||||
|
|
||||||
application {
|
application {
|
||||||
// Define the main class for the application.
|
// Define the main class for the application.
|
||||||
mainClass = "org.vibecoders.moongazer.App"
|
mainClass = "org.vibecoders.moongazer.Main"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
options.release.set(23)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<Test>("test") {
|
tasks.named<Test>("test") {
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
package org.vibecoders.moongazer;
|
|
||||||
|
|
||||||
import javafx.application.Application;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.layout.StackPane;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
public class App extends Application {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start(Stage stage) {
|
|
||||||
String javaVersion = System.getProperty("java.version");
|
|
||||||
String javafxVersion = System.getProperty("javafx.version");
|
|
||||||
Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
|
|
||||||
Scene scene = new Scene(new StackPane(l), 640, 480);
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
15
app/src/main/java/org/vibecoders/moongazer/Constants.java
Normal file
15
app/src/main/java/org/vibecoders/moongazer/Constants.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package org.vibecoders.moongazer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client configuration constants and default values
|
||||||
|
* used throughout the Moongazer client application.
|
||||||
|
*/
|
||||||
|
public class Constants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window configuration.
|
||||||
|
*/
|
||||||
|
public static final int WINDOW_WIDTH = 1280;
|
||||||
|
public static final int WINDOW_HEIGHT = 720;
|
||||||
|
public static final String WINDOW_TITLE = "Moongazer";
|
||||||
|
}
|
||||||
29
app/src/main/java/org/vibecoders/moongazer/Game.java
Normal file
29
app/src/main/java/org/vibecoders/moongazer/Game.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package org.vibecoders.moongazer;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.ApplicationAdapter;
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import static org.vibecoders.moongazer.Constants.*;
|
||||||
|
|
||||||
|
public class Game extends ApplicationAdapter {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(Game.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create() {
|
||||||
|
log.debug("create stub");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render() {
|
||||||
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||||
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
log.debug("stub");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
23
app/src/main/java/org/vibecoders/moongazer/Main.java
Normal file
23
app/src/main/java/org/vibecoders/moongazer/Main.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package org.vibecoders.moongazer;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||||
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import static org.vibecoders.moongazer.Constants.*;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(Main.class);
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Lwjgl3ApplicationConfiguration cfg = new Lwjgl3ApplicationConfiguration();
|
||||||
|
cfg.setTitle(WINDOW_TITLE);
|
||||||
|
cfg.setWindowedMode(WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||||
|
cfg.useVsync(true);
|
||||||
|
cfg.setIdleFPS(10);
|
||||||
|
cfg.setWindowIcon("icons/logo.png");
|
||||||
|
log.info("Starting game client");
|
||||||
|
new Lwjgl3Application(new Game(), cfg);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
app/src/main/resources/icons/logo.png
Normal file
BIN
app/src/main/resources/icons/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@ -1,5 +1,5 @@
|
|||||||
# This file was generated by the Gradle 'init' task.
|
# This file was generated by the Gradle 'init' task.
|
||||||
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
|
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
|
||||||
|
|
||||||
org.gradle.configuration-cache=true
|
org.gradle.configuration-cache=false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user