diff options
Diffstat (limited to 'composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/game/Renderer.kt')
| -rw-r--r-- | composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/game/Renderer.kt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/game/Renderer.kt b/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/game/Renderer.kt index 57511f3..8e28944 100644 --- a/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/game/Renderer.kt +++ b/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/game/Renderer.kt @@ -21,12 +21,14 @@ import kotlin.time.Duration * Depends on AnimationSystem to ensure animations are updated before rendering. */ class Renderer( - private val imageCache: ImageCache + private val imageCache: ImageCache, ) : System { - override val dependencies: Set<KClass<out System>> = setOf(AnimationSystem::class) - override fun update(world: World, duration: Duration) { + override fun update( + world: World, + duration: Duration, + ) { // Rendering happens in render() method, not here } @@ -34,7 +36,10 @@ class Renderer( * Renders all entities with sprites to the given DrawScope. * This should be called from a Compose Canvas during the draw phase. */ - fun render(world: World, drawScope: DrawScope) { + fun render( + world: World, + drawScope: DrawScope, + ) { // Query all entities that can be rendered world.query(Position::class, SpriteSheet::class, Animator::class).forEach { entity -> val position = entity.get(Position::class) ?: return@forEach @@ -57,7 +62,7 @@ class Renderer( srcOffset = IntOffset(frameRect.x, frameRect.y), srcSize = IntSize(frameRect.width, frameRect.height), dstOffset = IntOffset(position.x.toInt(), position.y.toInt()), - dstSize = IntSize(frameRect.width, frameRect.height) + dstSize = IntSize(frameRect.width, frameRect.height), ) } } |
