Understand LibGDX Coordinate system and drawing sprites

If you want to draw a sprite in center of screen, do this in your create method

logosprite.setposition(scrw/2-logosprite.getwidth()/2,scrh/2-logosprite.getheight/2);

here scrw is your viewport's width,

and scrh is your viewport's height,

this way your sprite will be in center of screen

sprite.setsize is used for setting size of the sprite and sprite.setscale is used when we scale a large/small texture so that its quality remains good in all devices(hdpi.mdpi,xhdpi,ldpi)..

no need to worry if you are using spine it works smoothly in libgdx..

Tags:

Libgdx