center

fun Camera.center(width: Float = Gdx.graphics.width.toFloat(), height: Float = Gdx.graphics.height.toFloat(), x: Float = 0.0f, y: Float = 0.0f)

Centers this Camera in the middle of the given rectangle. width and height represent the size of the rectangle in world (camera/viewport) units. x and y are optional offsets in world units that will modify camera position.

Note that Camera.update should be called in order to update to the new position.


fun BitmapFont.center(text: String, width: Float, height: Float, x: Float = 0.0f, y: Float = 0.0f): Vector2

Calculates center position of the chosen text written with this BitmapFont on an object with given width and height drawn at x and y coordinates.

The passed text rendered with the selected BitmapFont at the returned coordinates should be in the middle of the object.

Note that x and y are essentially an optional offset added to the calculated position.