追加部分素材

This commit is contained in:
2025-09-19 10:08:16 +08:00
parent 558c42e71d
commit dae9b8a2c6
10 changed files with 9 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ public class GameCore implements ApplicationListener {
@Override
public void create() {
batch = new SpriteBatch();
img = new Texture(Gdx.files.internal("src\\main\\resources\\assets\\badlogic.jpg"));
img = new Texture(Gdx.files.internal("src\\main\\resources\\assets\\backgrounds\\bg.png"));
}
@Override
@@ -21,8 +21,13 @@ public class GameCore implements ApplicationListener {
Gdx.gl.glClearColor(0.15f, 0.15f, 0.2f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
float screenWidth = Gdx.graphics.getWidth();
float screenHeight = Gdx.graphics.getHeight();
float scaleX = screenWidth / img.getWidth();
float scaleY = screenHeight / img.getHeight();
batch.begin();
batch.draw(img, 0, 0);
batch.draw(img, 0, 0, scaleX, scaleY);
batch.end();
}