diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ba339e6..a157698 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -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. */ +val libgdxVersion = "1.13.5" + plugins { // Apply the application plugin to add support for building a CLI application in Java. application @@ -29,6 +31,27 @@ dependencies { // This dependency is used by the application. 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. @@ -40,7 +63,12 @@ java { application { // Define the main class for the application. - mainClass = "org.vibecoders.moongazer.App" + mainClass = "org.vibecoders.moongazer.Main" +} + +tasks.withType().configureEach { + options.encoding = "UTF-8" + options.release.set(23) } tasks.named("test") { diff --git a/app/src/main/java/org/vibecoders/moongazer/App.java b/app/src/main/java/org/vibecoders/moongazer/App.java deleted file mode 100644 index f1087ef..0000000 --- a/app/src/main/java/org/vibecoders/moongazer/App.java +++ /dev/null @@ -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(); - } - -} diff --git a/app/src/main/java/org/vibecoders/moongazer/Constants.java b/app/src/main/java/org/vibecoders/moongazer/Constants.java new file mode 100644 index 0000000..7e6351c --- /dev/null +++ b/app/src/main/java/org/vibecoders/moongazer/Constants.java @@ -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"; +} diff --git a/app/src/main/java/org/vibecoders/moongazer/Game.java b/app/src/main/java/org/vibecoders/moongazer/Game.java new file mode 100644 index 0000000..df9cba7 --- /dev/null +++ b/app/src/main/java/org/vibecoders/moongazer/Game.java @@ -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"); + } +} + diff --git a/app/src/main/java/org/vibecoders/moongazer/Main.java b/app/src/main/java/org/vibecoders/moongazer/Main.java new file mode 100644 index 0000000..0669654 --- /dev/null +++ b/app/src/main/java/org/vibecoders/moongazer/Main.java @@ -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); + } +} diff --git a/app/src/main/resources/icons/logo.png b/app/src/main/resources/icons/logo.png new file mode 100644 index 0000000..0e68307 Binary files /dev/null and b/app/src/main/resources/icons/logo.png differ diff --git a/app/src/test/java/org/vibecoders/moongazer/AppTest.java b/app/src/test/java/org/vibecoders/moongazer/GameTest.java similarity index 100% rename from app/src/test/java/org/vibecoders/moongazer/AppTest.java rename to app/src/test/java/org/vibecoders/moongazer/GameTest.java diff --git a/gradle.properties b/gradle.properties index 377538c..8cea2f0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # This file was generated by the Gradle 'init' task. # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties -org.gradle.configuration-cache=true +org.gradle.configuration-cache=false