Last Updated: February 25, 2016
· drabiter
Dsc 0105 0

Scale your sprites properly in LibGDX

Also use this tip to greet "Hello All!" :)

For first tip, some lines of pseudo code to scale your sprite which instance of Image class while maintaining the aspect ratio.

//you have an instance of Image
Image image = createInstanceOfImage();

//These lines will resize your sprite to half of screen's width while keeping the ratio
image.width = .5f *;

//To resize in height's scale
image.width = .5f *;

If you can't figure out yet whether use width or height as scale, use Scaling.fill will help.