【发布时间】:2014-12-01 23:01:38
【问题描述】:
所以我是 libGDX 的新手,我正在制作一个游戏,如果你按下它旋转的图像,这意味着它会改变另一个图像。 但我不知道该由谁来做,我需要一些帮助。
@Override
public void create () {
spriteBatch = new SpriteBatch();
font = new BitmapFont(true);
camera = new OrthographicCamera();
texture = new Texture(Gdx.files.internal("cable_side.png"));
textureRegion = new TextureRegion(texture);
textureRegion.flip(false, true);
texture2 = new Texture(Gdx.files.internal("cable_l_1.png"));
textureRegion2 = new TextureRegion(texture2);
textureRegion2.flip(false, true);
camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
@Override
public void render () {
Gdx.gl.glClearColor(0.4f, 0.4f, 0.4f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
spriteBatch.setProjectionMatrix(camera.combined);
spriteBatch.begin();
//font.draw(spriteBatch, "Hacking Time", 0, 0);
spriteBatch.draw(textureRegion2, 0, 0);
spriteBatch.draw(textureRegion, 32, 0);
spriteBatch.draw(textureRegion, 64, 0);
spriteBatch.draw(textureRegion, 96, 0);
spriteBatch.draw(textureRegion, 128, 0);
spriteBatch.draw(textureRegion, 160, 0);
spriteBatch.draw(textureRegion, 192, 0);
spriteBatch.draw(textureRegion, 224, 0);
spriteBatch.end();
}
这就是我所拥有的,第二个textureRegion 在水平方向,我想把它放在垂直方向,删除前一个。 请帮忙!
【问题讨论】:
标签: java image libgdx textures coordinates