@Override public void render() { // Update getInput(); b2dWorld.step(1f / 60f, 6, 2); camera.update(); cameraBak.update(); manager.update(); background.update(); // Draw Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT); // Background batch.setProjectionMatrix(cameraBak.combined); batch.begin(); background.draw(batch); batch.end(); batch.setProjectionMatrix(camera.combined); debugMatrix = batch.getProjectionMatrix().cpy().scale(PPM, PPM, 0); // debugRenderer.render(b2dWorld, debugMatrix); batch.begin(); manager.draw(batch); batch.end(); // GUI batch.setProjectionMatrix(cameraBak.combined); batch.begin(); drawGUI(batch); batch.end(); }
public void draw(Batch batch, float parentAlpha) { super.draw(batch, parentAlpha); rotation = (rotation + 0); sprite.setSize(screenRectangle.width, screenRectangle.height); sprite.setPosition(screenRectangle.x, screenRectangle.y); sprite.setOriginCenter(); if (Gdx.input.isKeyJustPressed(keyRight)) { body.setTransform(body.getPosition().x + 5, body.getPosition().y, body.getAngle()); } elapsedTime += Gdx.graphics.getDeltaTime(); // body.setTransform(body.getPosition(), rotation); batch.end(); batch.begin(); sprite.setRotation(rotation); sprite.draw(batch); // batch.draw(animation.getKeyFrame(elapsedTime, true), screenRectangle.x, screenRectangle.y, // screenRectangle.width, screenRectangle.height ); // animation.setFrameDuration(0.09f); }