summaryrefslogtreecommitdiff
path: root/composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-10-26 17:25:13 -0700
committerElizabeth Hunt <me@liz.coffee>2025-10-26 17:25:13 -0700
commit395aa7d1c312e495517701be11c21425d9a5838e (patch)
tree4ad184b082838c56149cc1d1efe191cfd3d0679b /composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt
parent64f825465de9fa30c4dfe2707067efdb96110db8 (diff)
downloadabstraction-engine-kt-395aa7d1c312e495517701be11c21425d9a5838e.tar.gz
abstraction-engine-kt-395aa7d1c312e495517701be11c21425d9a5838e.zip
Checkpoint
Diffstat (limited to 'composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt')
-rw-r--r--composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt32
1 files changed, 10 insertions, 22 deletions
diff --git a/composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt b/composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt
index fd3b6df..452517f 100644
--- a/composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt
+++ b/composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt
@@ -1,42 +1,30 @@
package coffee.liz.ecs
-import kotlin.jvm.JvmName
import kotlin.reflect.KClass
+import kotlin.time.Duration
/**
- * The World manages entities and systems.
+ * [World] is the state of the world.
+ * @param Outside is the state of the stuff outside the world (input, etc.).
*/
-interface World {
+interface World<Outside> {
/**
- * Create a new entity with a unique ID.
+ * Create unique [Entity] in the [World].
*/
fun createEntity(): Entity
/**
- * Destroy an entity and remove it from all caches.
+ * Remove [entity] from [World].
*/
- fun destroyEntity(entity: Entity)
+ fun removeEntity(entity: Entity)
/**
- * Get all entities that have all the specified component types.
+ * Get entities with a [Component] type.
*/
fun query(vararg componentTypes: KClass<out Component>): Set<Entity>
/**
- * Update all systems in dependency order.
- * @param deltaTime Time elapsed since last update in seconds
+ * Integrate the [World].
*/
- fun update(deltaTime: Float)
+ fun update(state: Outside, deltaTime: Duration)
}
-
-// Convenience extension for queries
-@JvmName("query1")
-inline fun <reified T : Component> World.query(): Set<Entity> = query(T::class)
-
-@JvmName("query2")
-inline fun <reified T1 : Component, reified T2 : Component> World.query(): Set<Entity> =
- query(T1::class, T2::class)
-
-@JvmName("query3")
-inline fun <reified T1 : Component, reified T2 : Component, reified T3 : Component> World.query(): Set<Entity> =
- query(T1::class, T2::class, T3::class)