Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

Does scene2d(libGDX) know when an image is drawn out of the screen?

$
0
0

I mean, I want to make a tiled map using scene2d, so in the render method of my game…

@Override
public void render(float delta) {
    Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    gameStage.getCamera().position.set(player.getX(), player.getY(), 0);
    gameStage.act(Gdx.graphics.getDeltaTime());
    gameStage.getBatch().begin();
    for(int i=0;i<20;i++)
        for(int j=0;j<20;j++)
            gameStage.getBatch().draw(tile,i*tileSize,j*tileSize,tileSize,tileSize);
    gameStage.getBatch().end();
    gameStage.draw();
}

Does scene2d know if the tile is out of the screen view, so it does not draw it, or do I have to implement code to fix it?

Sorry for my English.


Viewing all articles
Browse latest Browse all 434

Trending Articles