1
34
pom.xml
@@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<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>
|
||||
|
||||
<properties>
|
||||
@@ -18,21 +18,21 @@
|
||||
<gdx.version>1.12.1</gdx.version>
|
||||
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx</artifactId>
|
||||
<version>1.12.1</version> <!-- 替换为你的 LibGDX 版本 -->
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- FreeType 字体扩展 -->
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-freetype</artifactId>
|
||||
<version>1.12.1</version> <!-- 与 LibGDX 版本保持一致 -->
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 桌面平台的 FreeType 原生库 -->
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
@@ -54,17 +54,17 @@
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx</artifactId>
|
||||
<version>${gdx.version}</version>
|
||||
<version>1.12.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-backend-lwjgl3</artifactId>
|
||||
<version>${gdx.version}</version>
|
||||
<version>1.12.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-platform</artifactId>
|
||||
<version>${gdx.version}</version>
|
||||
<version>1.12.1</version>
|
||||
<classifier>natives-desktop</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -81,7 +81,7 @@
|
||||
<!-- 移除不必要的预览特性,除非确实需要 -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
@@ -89,10 +89,10 @@
|
||||
<configuration>
|
||||
<!-- 确保这个类路径与你实际的Launcher类位置一致 -->
|
||||
<!-- 例如:如果你的类文件在src/main/java/uno/mloluyu/Launcher.java -->
|
||||
<mainClass>uno.mloluyu.desktop.Launcher</mainClass>
|
||||
<mainClass>uno.mloluyu.desktop.DesktopLauncher</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!-- 添加运行时类路径配置,解决类找不到问题 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -102,13 +102,13 @@
|
||||
<archive>
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<mainClass>uno.mloluyu.desktop.Launcher</mainClass>
|
||||
<mainClass>uno.mloluyu.desktop.DesktopLauncher</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
package uno.mloluyu.desktop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import uno.mloluyu.network.NetworkManager;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
|
||||
import uno.mloluyu.characters.character.Alice;
|
||||
import uno.mloluyu.characters.AdvancedFighter;
|
||||
import uno.mloluyu.characters.SimpleFighter;
|
||||
import uno.mloluyu.characters.character.Reimu;
|
||||
import uno.mloluyu.util.ClearScreen;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -29,6 +30,15 @@ public class CharacterSelectScreen extends ScreenAdapter {
|
||||
private BitmapFont font;
|
||||
private ShapeRenderer shapeRenderer;
|
||||
|
||||
private final List<Texture> bgs = Arrays.asList(
|
||||
new Texture(Gdx.files.internal("src/main/resources/selectpage/10b_back_blue2p.png")),
|
||||
new Texture(Gdx.files.internal("src/main/resources/selectpage/11b_back_red1p.png")),
|
||||
new Texture(Gdx.files.internal("src/main/resources/selectpage/back_door.png"))
|
||||
);
|
||||
private final List<Texture> charsTexts = Arrays.asList(
|
||||
new Texture(Gdx.files.internal("src/main/resources/selectpage/character_03.png")),
|
||||
new Texture(Gdx.files.internal("src/main/resources/selectpage/character_00.png"))
|
||||
);
|
||||
private final List<String> characters = Arrays.asList("Alice", "Reimu", "暂定");
|
||||
private int selectedIndex = -1;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
@@ -19,17 +20,21 @@ public class MainMenuScreen extends ScreenAdapter {
|
||||
private SpriteBatch batch;
|
||||
private BitmapFont font;
|
||||
private ShapeRenderer shapeRenderer;
|
||||
private Texture texture;
|
||||
|
||||
// 按钮区域
|
||||
private final int buttonWidth = 400;
|
||||
private final int buttonWidth = 600;
|
||||
private final int buttonHeight = 80;
|
||||
private final int buttonX = 760;
|
||||
private final int startY = 600;
|
||||
private final int settingsY = 480;
|
||||
private final int networkY = 360;
|
||||
private final int escY = 240;
|
||||
|
||||
public MainMenuScreen(MainGame game) {
|
||||
this.game = game;
|
||||
texture = new Texture(Gdx.files.internal("src\\main\\resources\\bg.png"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,7 +48,7 @@ public class MainMenuScreen extends ScreenAdapter {
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
Gdx.gl.glClearColor(0.75F, 1, 0.98F, 1);
|
||||
Gdx.gl.glClearColor(0,0,0,0);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
int mouseX = Gdx.input.getX();
|
||||
@@ -54,13 +59,16 @@ public class MainMenuScreen extends ScreenAdapter {
|
||||
drawButtonBox(startY, "开始游戏", mouseX, mouseY);
|
||||
drawButtonBox(settingsY, "设置", mouseX, mouseY);
|
||||
drawButtonBox(networkY, "联网设置", mouseX, mouseY);
|
||||
drawButtonBox(escY, "退出游戏", mouseX, mouseY);
|
||||
shapeRenderer.end();
|
||||
|
||||
// 绘制按钮文字
|
||||
batch.begin();
|
||||
batch.draw(texture, 0, 0, 1920, 1080);
|
||||
drawButtonText(startY, "开始游戏");
|
||||
drawButtonText(settingsY, "设置");
|
||||
drawButtonText(networkY, "联网设置");
|
||||
drawButtonText(escY, "退出游戏");
|
||||
batch.end();
|
||||
|
||||
// 点击事件
|
||||
@@ -73,6 +81,8 @@ public class MainMenuScreen extends ScreenAdapter {
|
||||
} else if (isTouched(mouseX, mouseY, buttonX, networkY)) {
|
||||
Gdx.app.log("Button", "联网设置按钮被点击!");
|
||||
game.setScreen(new NetworkSettingsScreen(game));
|
||||
} else if (isTouched(mouseX, mouseY, buttonX, escY)) {
|
||||
Gdx.app.exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class StartScreen implements Screen {
|
||||
}
|
||||
}
|
||||
|
||||
Gdx.gl.glClearColor(0.75F, 1, 0.98F, 1);
|
||||
Gdx.gl.glClearColor(1, 1, 1, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
batch.begin();
|
||||
|
||||
BIN
src/main/resources/bg.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 29 KiB |
BIN
src/main/resources/selectpage/10b_back_blue2p.png
Normal file
|
After Width: | Height: | Size: 440 KiB |
BIN
src/main/resources/selectpage/11b_back_red1p.png
Normal file
|
After Width: | Height: | Size: 440 KiB |
BIN
src/main/resources/selectpage/back_door.png
Normal file
|
After Width: | Height: | Size: 320 KiB |
BIN
src/main/resources/selectpage/character_00.png
Normal file
|
After Width: | Height: | Size: 576 KiB |
BIN
src/main/resources/selectpage/character_03.png
Normal file
|
After Width: | Height: | Size: 384 KiB |