Well, I’ve worked very little with libgdx, but from what I’ve seen, you can use Viewports to resize your image, however, I confess that I have never tested it in this way.
Another solution, which I’ve seen being implemented is to create your own function to resize your Sprite, for example:
public static float MINHA_PROPORCAO = WIDTH_IMAGEM / Gdx.graphics.getWidth(); // Calcula uma proporção baseada no tamanho da tela.
public static Sprite CriarSprite(Texture textura) {
Sprite sprite = new Sprite(textura);
sprite.getTexture().setFilter(TextureFilter.Linear,TextureFilter.Linear);
sprite.setSize(sprite.getWidth() / MINHA_PROPORCAO ,
sprite.getHeight() / MINHA_PROPORCAO );
return sprite;
}
I hope it helps :)
You are using a Sprite for the image ?
– Lucas Queiroz Ribeiro
yes friend. Actor with Sprite
– Emerson Barcellos
would be more or less that (https://igoralves1.github.io/) what you want? The image can be opened by any device. But in my case I chose to use 100% of the screen.
– zwitterion