summaryrefslogtreecommitdiff
path: root/composeApp/src/commonMain/kotlin/coffee/liz/ecs/World.kt
blob: 452517f7308d1616c8e8d6af43121a2b3e6898d1 (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
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)
}