summaryrefslogtreecommitdiff
path: root/composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt
blob: f49e79f49cf0417ea6b816b99bdd6afd5081fbe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package coffee.liz.ecs

import kotlin.reflect.KClass
import kotlin.time.Duration

/**
 * [World] is the state of the world.
 * @param Outside is the state of the stuff outside the world (input, etc.).
 */
interface World<Outside> {
    /**
     * Create unique [Entity] in the [World].
     */
    fun createEntity(): Entity

    /**
     * Remove [entity] from [World].
     */
    fun removeEntity(entity: Entity)

    /**
     * Get entities with a [Component] type.
     */
    fun query(vararg componentTypes: KClass<out Component>): Set<Entity>

    /**
     * Integrate the [World].
     */
    fun update(
        state: Outside,
        deltaTime: Duration,
    )
}