【发布时间】:2013-07-12 20:18:57
【问题描述】:
我在 libGdx 中的背景有问题。 我尝试用这个解决我的问题:
“在你的 create() 方法中,创建一个引用你的 image.png 的新纹理,然后使用你现有的 SpriteBatch 在 render() 循环中渲染它。在你的 GL.clear() 调用之后,立即执行你的批处理.draw(backgroundTexture, 0. 0) 并确保您的相机处于正交投影模式。”
我这样做:
public void render() {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
camera.update();
batch.setProjectionMatrix(camera.combined);
batch.begin();
batch.draw(image, 250, 200);
batch.draw(backGroundImage, 0, 0);
batch.end();
“image”是我的普通纹理(它是简单的图像),“backGround”是ofc。我的背景。
我在我的 create() 方法中应用了“背景”。我的摄像头在 camera = new OrthographicCamera();。
这是我看到的:
...我需要 10 点声望来添加图像:<... href="https://stackoverflow.com/questions/9384662/libgdx-and-android-application-image-as-background" target="_blank" rel="nofollow">a link!还有一个指向 [a panda][1] Shinzul 的参考风格链接说了一些关于 render() 中循环的内容,也许这是我的问题,但我不知道如何解决这个问题。
请帮忙。
【问题讨论】: