c# - How to center an image in a rectangle? -
how center image inside rectangle with:
batch.draw(imagename, new rectangle(x, y, imagename.width, imagename.height), color.white);
you can use origin overload spritebatch
batch.draw(imagename, new rectangle(x, y, imagename.width, imagename.height), color.white,0f,new vector2(imagename.width /2, imagename.height /2) ,spriteeffects.null, 0);
Comments
Post a Comment