我正试图" port"我从badlogicgame引擎到libgdx的游戏,我有一个奇怪的问题。 我已经看到一些这样的帖子发生在我身上,但我认为这有点不同(这就是我打开另一个帖子的原因,但如果你认为这是在之前的一篇文章中回答的,我将其关闭。)
我开始,我使用的是superJumper字体
包com.redgehog;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector3;
public class MainMenuScreen extends ScreenAdapter {
IceBucketMulti game;
OrthographicCamera guiCam;
Rectangle soundBounds;
Rectangle playBounds;
Rectangle highscoresBounds;
Rectangle helpBounds;
Vector3 touchPoint;
public MainMenuScreen (IceBucketMulti game) {
this.game = game;
guiCam = new OrthographicCamera(480, 320);
guiCam.position.set(480 / 2, 320 / 2, 0);
soundBounds = new Rectangle(0, 0, 64, 64);
playBounds = new Rectangle(160 - 150, 200 + 18, 300, 36);
highscoresBounds = new Rectangle(160 - 150, 200 - 18, 300, 36);
helpBounds = new Rectangle(160 - 150, 200 - 18 - 36, 300, 36);
touchPoint = new Vector3();
}
public void draw () {
GL20 gl = Gdx.gl;
gl.glClearColor(1, 1, 1, 1);
gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
guiCam.update();
game.batcher.setProjectionMatrix(guiCam.combined);
game.batcher.disableBlending();
game.batcher.begin();
game.batcher.draw(Assets.backgroundRegionSU, 0, 0, 480, 320);
game.batcher.end();
game.batcher.enableBlending();
game.batcher.begin();
game.batcher.draw(Assets.mainMenuRegion, 10, 200 - 110 / 2, 300, 110);
game.batcher.end();
}
@Override
public void render (float delta) {
update();
draw();
}
@Override
public void pause () {
Settings.save();
}
}
它适用于原始背景,但当我放置我的图像时它停止工作......我不明白原因...我试图改变大小和ppp以匹配原始图像但是相同结果
我尝试将整个纹理放在一起然后就可以了......我用原始的libgdx superjumper版本和最后一个libgdx版本尝试了这段代码。
有什么想法吗?
谢谢,
答案 0 :(得分:0)
我发现了......
问题出在“资产档案”里面,我没有为[loadTexture(“background.png”)]改变[new Texture(“background.png”)]
抱歉,谢谢