Compare commits

...

4 Commits

Author SHA1 Message Date
7c26fd7ce6 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	target/classes/uno/mloluyu/characters/Alice.class
#	target/classes/uno/mloluyu/network/CreateServer$1.class
#	target/classes/uno/mloluyu/network/CreateServer.class
2025-09-22 15:22:07 +08:00
3dcb067a3d 添加标题背景 2025-09-22 15:19:50 +08:00
3362cacc72 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/main/java/uno/mloluyu/characters/Alice.java
#	src/main/java/uno/mloluyu/desktop/GameCore.java
#	src/main/java/uno/mloluyu/desktop/Launcher.java
#	target/classes/uno/mloluyu/characters/Alice.class
#	target/classes/uno/mloluyu/characters/Fighter$Action.class
#	target/classes/uno/mloluyu/characters/Fighter.class
#	target/classes/uno/mloluyu/desktop/GameCore.class
#	target/classes/uno/mloluyu/desktop/Launcher.class
2025-09-22 14:51:35 +08:00
8723b1354d 更新项目说明以及清空多余素材 2025-09-22 14:44:02 +08:00
19 changed files with 118 additions and 151 deletions

View File

@@ -23,6 +23,7 @@ public abstract class Fighter implements Disposable {
SPECIAL1, SPECIAL2,
DEATH
}
protected String name;
// 画帧间隔(秒)
protected static final float DEFAULT_FRAME_DURATION = 0.1f;
@@ -374,6 +375,8 @@ public abstract class Fighter implements Disposable {
return attackPower;
}
public String getName(){ return ""; }
@Override
public void dispose() {
}

View File

@@ -0,0 +1,10 @@
package uno.mloluyu.characters;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
public class FighterList {
public static final TextureAtlas aliceAtlas = new TextureAtlas(Gdx.files.internal("src\\main\\resources\\character\\alice\\alice.atlas"));
}

View File

@@ -3,44 +3,57 @@ 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;
import uno.mloluyu.Controller.FighterController;
import com.badlogic.gdx.utils.Scaling;
import com.badlogic.gdx.utils.viewport.ExtendViewport;
import com.badlogic.gdx.utils.viewport.ScalingViewport;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import uno.mloluyu.characters.Alice;
import uno.mloluyu.characters.FighterList;
public class GameCore implements ApplicationListener {
private SpriteBatch batch;
private Alice alice1;
private FighterController controller;
private Viewport viewport;
private Gaming gaming;
private Texture texture;
@Override
public void create() {
viewport = new ScalingViewport(Scaling.none, Launcher.width, Launcher.width);
texture = new Texture(Gdx.files.internal("src\\main\\resources\\backgrounds\\bg.png"));
batch = new SpriteBatch();
alice1= new Alice();
controller = new FighterController(alice1);
Gdx.input.setInputProcessor(controller);
gaming = new Gaming(new Alice(), new Alice());
gaming.create();
}
@Override
public void render() {
Gdx.gl.glClearColor(150, 150, 150, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
alice1.update(Gdx.graphics.getDeltaTime());
controller.update(Gdx.graphics.getDeltaTime());
viewport.apply();
batch.begin();
alice1.render(batch);
batch.draw(texture, 0, 0);
// alice1.update(Gdx.graphics.getDeltaTime());
// batch.begin();
// alice1.render(batch);
// batch.end();
gaming.render();
batch.end();
}
@Override
public void dispose() {
alice1.dispose();
gaming.dispose();
}
@Override
public void resize(int width, int height) {
// 应用新的视口设置
viewport.update(width, height, true); // 第三个参数 true 表示相机居中
}
@Override

View File

@@ -1,5 +1,38 @@
package uno.mloluyu.desktop;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.viewport.ExtendViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import uno.mloluyu.characters.Fighter;
public class Gaming {
private Fighter selfFighter;
private Fighter frontFighter;
private SpriteBatch batch;
public Gaming(Fighter selfFighter, Fighter frontFighter) {
this.selfFighter = selfFighter;
this.frontFighter = frontFighter;
}
public void create() {
batch = new SpriteBatch();
}
public void render() {
selfFighter.update(Gdx.graphics.getDeltaTime());
frontFighter.update(Gdx.graphics.getDeltaTime());
batch.begin();
selfFighter.render(batch);
selfFighter.render(batch);
batch.end();
}
public void dispose() {
selfFighter.dispose();
frontFighter.dispose();
}
}

View File

@@ -1,15 +1,17 @@
package uno.mloluyu.desktop;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
public class Launcher {
private static int width;
private static int height;
public static final int width = 640;
public static final int height = 480;
public static void main(String[] args) {
Lwjgl3ApplicationConfiguration configuration = new Lwjgl3ApplicationConfiguration();
configuration.setTitle("Test Game");
configuration.setWindowedMode(2600,1600);
configuration.setWindowedMode(width, height);
configuration.setForegroundFPS(60);
configuration.useVsync(true);
new Lwjgl3Application(new GameCore(), configuration);

View File

@@ -1,5 +1,45 @@
package uno.mloluyu.network;
public class ConnectServer {
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Net;
import com.badlogic.gdx.net.Socket;
import uno.mloluyu.desktop.Gaming;
import java.io.InputStream;
import java.io.OutputStream;
public class ConnectServer {
private static Socket socket;
private static String host = "";
private static int port = 10800;
public static void connectServer() {
new Thread(new Runnable() {
@Override
public void run() {
try {
socket = Gdx.net.newClientSocket(Net.Protocol.TCP, host, port, null);
OutputStream outputStream = socket.getOutputStream();//读取套接字的数据流
InputStream inputStream = socket.getInputStream();
//Gaming gaming = new Gaming(); //进入游戏界面
//gaming.render();
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
}
});
} catch (Exception e) {
} finally {
if (socket != null) {
socket.dispose();
}
}
}
});
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -1,67 +0,0 @@
innerbg.png
size:1536,1024
repeat:none
0000_00
bounds:0,0,256,256
0000_01
bounds:256,0,256,256
0000_02
bounds:512,0,256,256
0000_03
bounds:768,0,256,256
0000_04
bounds:1024,0,256,256
0000_05
bounds:1280,0,120,256
0000_06
bounds:0,256,256,256
0000_07
bounds:256,256,256,256
0000_08
bounds:512,256,256,256
0000_09
bounds:768,256,256,256
0000_10
bounds:1024,256,256,256
0000_11
bounds:1280,256,120,256
0000_12
bounds:0,512,256,256
0000_13
bounds:256,512,256,256
0000_14
bounds:512,512,256,256
0000_15
bounds:768,512,256,256
0000_16
bounds:1024,512,256,256
0000_17
bounds:1280,512,120,256
0000_18
bounds:0,768,256,256
0000_19
bounds:256,768,256,256
0000_20
bounds:512,768,256,256
0000_21
bounds:768,768,256,256
0000_22
bounds:1024,768,256,256
0000_23
bounds:1280,768,120,256
innerbg2.png
size:1536,256
repeat:none
0000_24
bounds:0,0,256,176
0000_25
bounds:256,0,256,176
0000_26
bounds:512,0,256,176
0000_27
bounds:768,0,256,176
0000_28
bounds:1024,0,256,176
0000_29
bounds:1280,0,120,176

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -1,67 +0,0 @@
innerbg.png
size:1536,1024
repeat:none
0000_00
bounds:0,0,256,256
0000_01
bounds:256,0,256,256
0000_02
bounds:512,0,256,256
0000_03
bounds:768,0,256,256
0000_04
bounds:1024,0,256,256
0000_05
bounds:1280,0,120,256
0000_06
bounds:0,256,256,256
0000_07
bounds:256,256,256,256
0000_08
bounds:512,256,256,256
0000_09
bounds:768,256,256,256
0000_10
bounds:1024,256,256,256
0000_11
bounds:1280,256,120,256
0000_12
bounds:0,512,256,256
0000_13
bounds:256,512,256,256
0000_14
bounds:512,512,256,256
0000_15
bounds:768,512,256,256
0000_16
bounds:1024,512,256,256
0000_17
bounds:1280,512,120,256
0000_18
bounds:0,768,256,256
0000_19
bounds:256,768,256,256
0000_20
bounds:512,768,256,256
0000_21
bounds:768,768,256,256
0000_22
bounds:1024,768,256,256
0000_23
bounds:1280,768,120,256
innerbg2.png
size:1536,256
repeat:none
0000_24
bounds:0,0,256,176
0000_25
bounds:256,0,256,176
0000_26
bounds:512,0,256,176
0000_27
bounds:768,0,256,176
0000_28
bounds:1024,0,256,176
0000_29
bounds:1280,0,120,176

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB