This commit is contained in:
2025-09-25 18:43:36 +08:00
parent 64d3815ddd
commit 3b053514ff
11 changed files with 43 additions and 23 deletions

10
pom.xml
View File

@@ -54,17 +54,17 @@
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx</artifactId> <artifactId>gdx</artifactId>
<version>${gdx.version}</version> <version>1.12.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-backend-lwjgl3</artifactId> <artifactId>gdx-backend-lwjgl3</artifactId>
<version>${gdx.version}</version> <version>1.12.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-platform</artifactId> <artifactId>gdx-platform</artifactId>
<version>${gdx.version}</version> <version>1.12.1</version>
<classifier>natives-desktop</classifier> <classifier>natives-desktop</classifier>
</dependency> </dependency>
</dependencies> </dependencies>
@@ -89,7 +89,7 @@
<configuration> <configuration>
<!-- 确保这个类路径与你实际的Launcher类位置一致 --> <!-- 确保这个类路径与你实际的Launcher类位置一致 -->
<!-- 例如如果你的类文件在src/main/java/uno/mloluyu/Launcher.java --> <!-- 例如如果你的类文件在src/main/java/uno/mloluyu/Launcher.java -->
<mainClass>uno.mloluyu.desktop.Launcher</mainClass> <mainClass>uno.mloluyu.desktop.DesktopLauncher</mainClass>
</configuration> </configuration>
</plugin> </plugin>
@@ -102,7 +102,7 @@
<archive> <archive>
<manifest> <manifest>
<addClasspath>true</addClasspath> <addClasspath>true</addClasspath>
<mainClass>uno.mloluyu.desktop.Launcher</mainClass> <mainClass>uno.mloluyu.desktop.DesktopLauncher</mainClass>
</manifest> </manifest>
</archive> </archive>
</configuration> </configuration>

View File

@@ -1,20 +1,21 @@
package uno.mloluyu.desktop; package uno.mloluyu.desktop;
import java.util.ArrayList;
import java.util.UUID; import java.util.UUID;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import uno.mloluyu.network.NetworkManager; import uno.mloluyu.network.NetworkManager;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter; import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.Color; 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.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import uno.mloluyu.characters.character.Alice;
import uno.mloluyu.characters.AdvancedFighter; import uno.mloluyu.characters.AdvancedFighter;
import uno.mloluyu.characters.SimpleFighter; import uno.mloluyu.characters.SimpleFighter;
import uno.mloluyu.characters.character.Reimu;
import uno.mloluyu.util.ClearScreen; import uno.mloluyu.util.ClearScreen;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -29,6 +30,15 @@ public class CharacterSelectScreen extends ScreenAdapter {
private BitmapFont font; private BitmapFont font;
private ShapeRenderer shapeRenderer; 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 final List<String> characters = Arrays.asList("Alice", "Reimu", "暂定");
private int selectedIndex = -1; private int selectedIndex = -1;

View File

@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter; import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
@@ -19,17 +20,21 @@ public class MainMenuScreen extends ScreenAdapter {
private SpriteBatch batch; private SpriteBatch batch;
private BitmapFont font; private BitmapFont font;
private ShapeRenderer shapeRenderer; private ShapeRenderer shapeRenderer;
private Texture texture;
// 按钮区域 // 按钮区域
private final int buttonWidth = 400; private final int buttonWidth = 600;
private final int buttonHeight = 80; private final int buttonHeight = 80;
private final int buttonX = 760; private final int buttonX = 760;
private final int startY = 600; private final int startY = 600;
private final int settingsY = 480; private final int settingsY = 480;
private final int networkY = 360; private final int networkY = 360;
private final int escY = 240;
public MainMenuScreen(MainGame game) { public MainMenuScreen(MainGame game) {
this.game = game; this.game = game;
texture = new Texture(Gdx.files.internal("src\\main\\resources\\bg.png"));
} }
@Override @Override
@@ -43,7 +48,7 @@ public class MainMenuScreen extends ScreenAdapter {
@Override @Override
public void render(float delta) { 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); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
int mouseX = Gdx.input.getX(); int mouseX = Gdx.input.getX();
@@ -54,13 +59,16 @@ public class MainMenuScreen extends ScreenAdapter {
drawButtonBox(startY, "开始游戏", mouseX, mouseY); drawButtonBox(startY, "开始游戏", mouseX, mouseY);
drawButtonBox(settingsY, "设置", mouseX, mouseY); drawButtonBox(settingsY, "设置", mouseX, mouseY);
drawButtonBox(networkY, "联网设置", mouseX, mouseY); drawButtonBox(networkY, "联网设置", mouseX, mouseY);
drawButtonBox(escY, "退出游戏", mouseX, mouseY);
shapeRenderer.end(); shapeRenderer.end();
// 绘制按钮文字 // 绘制按钮文字
batch.begin(); batch.begin();
batch.draw(texture, 0, 0, 1920, 1080);
drawButtonText(startY, "开始游戏"); drawButtonText(startY, "开始游戏");
drawButtonText(settingsY, "设置"); drawButtonText(settingsY, "设置");
drawButtonText(networkY, "联网设置"); drawButtonText(networkY, "联网设置");
drawButtonText(escY, "退出游戏");
batch.end(); batch.end();
// 点击事件 // 点击事件
@@ -73,6 +81,8 @@ public class MainMenuScreen extends ScreenAdapter {
} else if (isTouched(mouseX, mouseY, buttonX, networkY)) { } else if (isTouched(mouseX, mouseY, buttonX, networkY)) {
Gdx.app.log("Button", "联网设置按钮被点击!"); Gdx.app.log("Button", "联网设置按钮被点击!");
game.setScreen(new NetworkSettingsScreen(game)); game.setScreen(new NetworkSettingsScreen(game));
} else if (isTouched(mouseX, mouseY, buttonX, escY)) {
Gdx.app.exit();
} }
} }
} }

View File

@@ -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); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin(); batch.begin();

BIN
src/main/resources/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB