DEADSOFTWARE

Add player head rotation
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / misc / utils / SpriteUtils.kt
1 package ru.deadsoftware.cavedroid.misc.utils
3 import com.badlogic.gdx.graphics.g2d.Sprite
4 import com.badlogic.gdx.graphics.g2d.SpriteBatch
6 /**
7 * Draw sprite at given position rotated by [rotation] degrees
8 */
9 @JvmOverloads
10 fun SpriteBatch.draw(sprite: Sprite, x: Float, y: Float, rotation: Float = 0f) {
11 sprite.rotation = rotation
12 sprite.setPosition(x, y)
13 sprite.draw(this)
14 }