summaryrefslogtreecommitdiff
path: root/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/game/Renderer.kt
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-10-26 21:38:22 -0700
committerElizabeth Hunt <me@liz.coffee>2025-10-26 21:39:58 -0700
commita8e5e723b7e1891c9b352261a3ee4c3d3563e8cf (patch)
tree853df79c877d37d7e5d25f52b301aedcc3d5db55 /composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/game/Renderer.kt
parent395aa7d1c312e495517701be11c21425d9a5838e (diff)
downloadabstraction-engine-kt-main.tar.gz
abstraction-engine-kt-main.zip
Checkpoint twoHEADmain
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.kt15
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),
)
}
}