Merge branch 'main'
This commit is contained in:
83
client/pom.xml
Normal file
83
client/pom.xml
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>game-parent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>game-client</artifactId>
|
||||
<name>Game Client</name>
|
||||
<url>http://www.example.com</url>
|
||||
|
||||
<!-- 依赖配置(无需写版本号,继承父模块) -->
|
||||
<dependencies>
|
||||
<!-- 依赖核心模块 -->
|
||||
<dependency>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- libGDX桌面客户端依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-backend-lwjgl3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-platform</artifactId>
|
||||
<classifier>natives-desktop</classifier>
|
||||
</dependency>
|
||||
|
||||
<!-- 测试依赖 -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- 构建配置(生成可执行JAR) -->
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 编译插件(继承父模块版本) -->
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<!-- 打包包含所有依赖的可执行JAR -->
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.example.client.DesktopLauncher</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
11
client/src/main/java/com/example/App.java
Normal file
11
client/src/main/java/com/example/App.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.example;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello 12!");
|
||||
}
|
||||
}
|
||||
47
client/src/main/java/com/example/MyGdxGame.java
Normal file
47
client/src/main/java/com/example/MyGdxGame.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.example;
|
||||
import com.badlogic.gdx.ApplicationListener;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
|
||||
public class MyGdxGame implements ApplicationListener {
|
||||
// 游戏初始化时调用
|
||||
@Override
|
||||
public void create() {
|
||||
// 加载资源、初始化游戏对象
|
||||
|
||||
}
|
||||
|
||||
// 每次渲染时调用
|
||||
@Override
|
||||
public void render() {
|
||||
// 清空屏幕
|
||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// 游戏逻辑更新和渲染
|
||||
}
|
||||
|
||||
// 窗口大小改变时调用
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
|
||||
}
|
||||
|
||||
// 游戏暂停时调用(如Android上按下Home键)
|
||||
@Override
|
||||
public void pause() {
|
||||
|
||||
}
|
||||
|
||||
// 游戏恢复时调用
|
||||
@Override
|
||||
public void resume() {
|
||||
|
||||
}
|
||||
|
||||
// 游戏退出时调用,释放资源
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
||||
}
|
||||
}
|
||||
20
client/src/test/java/com/example/AppTest.java
Normal file
20
client/src/test/java/com/example/AppTest.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.example;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
{
|
||||
/**
|
||||
* Rigorous Test :-)
|
||||
*/
|
||||
@Test
|
||||
public void shouldAnswerWithTrue()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
||||
BIN
client/target/classes/com/example/App.class
Normal file
BIN
client/target/classes/com/example/App.class
Normal file
Binary file not shown.
BIN
client/target/classes/com/example/MyGdxGame.class
Normal file
BIN
client/target/classes/com/example/MyGdxGame.class
Normal file
Binary file not shown.
BIN
client/target/test-classes/com/example/AppTest.class
Normal file
BIN
client/target/test-classes/com/example/AppTest.class
Normal file
Binary file not shown.
Reference in New Issue
Block a user