
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 0.98 KB | hits: 14 | expires: Never
How use wait for batch in Libgdx
public void render() {
x = rand.nextFloat() * 1024;
y = rand.nextFloat() * 700;
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(texture, x, y);
if (Gdx.input.justTouched()) {
if (Gdx.input.getX() > x && Gdx.input.getX() < texture.getWidth() + x) {
if (Gdx.input.getY() > y && Gdx.input.getY() < texture.getHeight() + y) {
batch.end();
}
}
}
}
public void render() {
x = rand.nextFloat() * 1024;
y = rand.nextFloat() * 700;
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(texture, x, y);
try {
batch.wait();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
batch.end();
}
public void render() {
...
if(Gdx.input.isButtonPressed(Buttons.LEFT)) {
//move sprite left
}
}
Gdx.input.setInputProcessor(yourInputProcessor);