主要的文件结构

This commit is contained in:
2025-09-17 11:25:48 +08:00
parent 3ed45b6889
commit 2680cab9cd
5 changed files with 112 additions and 0 deletions

BIN
Game.zip

Binary file not shown.

56
pom.xml Normal file
View File

@@ -0,0 +1,56 @@
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>uno.mloluyu</groupId>
<artifactId>game</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx</artifactId>
<version>1.12.1</version>
</dependency>
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-backend-lwjgl3</artifactId>
<version>1.12.1</version>
</dependency>
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-platform</artifactId>
<version>1.12.1</version>
<classifier>natives-desktop</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>21</source>
<target>21</target>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<mainClass>uno.mloluyu.desktop.Launcher</mainClass> <!-- 替换为你的桌面启动器完整类名 -->
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gdx.version>1.12.1</gdx.version>
</properties>
</project>

View File

@@ -0,0 +1,41 @@
package uno.mloluyu.desktop;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class GameCore implements ApplicationListener {
private SpriteBatch batch;
private Texture img;
@Override
public void create() {
batch = new SpriteBatch();
img = new Texture(Gdx.files.internal("badlogic.jpg"));
}
@Override
public void render() {
Gdx.gl.glClearColor(0.15f, 0.15f, 0.2f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(img, 0, 0);
batch.end();
}
@Override
public void dispose() {
batch.dispose();
img.dispose();
}
@Override
public void resize(int width, int height) {}
@Override
public void pause() {}
@Override
public void resume() {}
}

View File

@@ -0,0 +1,15 @@
package uno.mloluyu.desktop;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
public class Launcher {
public static void main(String[] args) {
Lwjgl3ApplicationConfiguration configuration = new Lwjgl3ApplicationConfiguration();
configuration.setTitle("Test Game");
configuration.setWindowedMode(800, 600);
configuration.setForegroundFPS(60);
configuration.useVsync(true);
new Lwjgl3Application(new GameCore(), configuration);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 MiB