追加部分素材
This commit is contained in:
4
pom.xml
4
pom.xml
@@ -51,7 +51,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<!-- 确保这个类路径与你实际的Launcher类位置一致 -->
|
<!-- 确保这个类路径与你实际的Launcher类位置一致 -->
|
||||||
<!-- 例如:如果你的类文件在src/main/java/uno/mloluyu/Launcher.java -->
|
<!-- 例如:如果你的类文件在src/main/java/uno/mloluyu/Launcher.java -->
|
||||||
<mainClass>uno.mloluyu.Launcher</mainClass>
|
<mainClass>uno.mloluyu.desktop.Launcher</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
<archive>
|
<archive>
|
||||||
<manifest>
|
<manifest>
|
||||||
<addClasspath>true</addClasspath>
|
<addClasspath>true</addClasspath>
|
||||||
<mainClass>uno.mloluyu.Launcher</mainClass>
|
<mainClass>uno.mloluyu.desktop.Launcher</mainClass>
|
||||||
</manifest>
|
</manifest>
|
||||||
</archive>
|
</archive>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class GameCore implements ApplicationListener {
|
|||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
batch = new SpriteBatch();
|
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
|
@Override
|
||||||
@@ -21,8 +21,13 @@ public class GameCore implements ApplicationListener {
|
|||||||
Gdx.gl.glClearColor(0.15f, 0.15f, 0.2f, 1);
|
Gdx.gl.glClearColor(0.15f, 0.15f, 0.2f, 1);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
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.begin();
|
||||||
batch.draw(img, 0, 0);
|
batch.draw(img, 0, 0, scaleX, scaleY);
|
||||||
batch.end();
|
batch.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
src/main/resources/assets/backgrounds/bg.png
Normal file
BIN
src/main/resources/assets/backgrounds/bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
BIN
target/classes/assets/backgrounds/bg.png
Normal file
BIN
target/classes/assets/backgrounds/bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user