Sign in

    Milky2018/mgstudio/core does not have a README file

    Tick

    type Tick = Int

    ChangeTickWorld

    pub(open) trait ChangeTickWorld {
    read_change_tick(self : Self) -> Int
    increment_change_tick(self : Self) -> Int
    }

    SpawnWorld

    pub(open) trait SpawnWorld {
    spawn_empty(self : Self) -> Entity
    despawn(self : Self, entity : Entity) -> Unit raise EntityError
    }

    Minimal trait for worlds that can spawn/despawn entities.

    This is used by engine helpers that are generic over a generated World type, without depending on a concrete ecs_world package (avoids cycles).

    SystemContextWorld

    pub(open) trait SystemContextWorld {
    get_system_context(self : Self) -> SystemContext
    set_system_context(self : Self, ctx : SystemContext) -> Unit
    }

    EntityError

    pub(all) suberror EntityError {
    InvalidId(Int)
    NotSpawned(Entity)
    GenerationMismatch(Entity, Int)
    }

    ComponentStore

    pub struct ComponentStore[T] {
    storage : SparseSet[T]
    ticks : Array[ComponentTicks]
    }

    ComponentStore::contains

    fn[T] ComponentStore::contains(self : ComponentStore[T], entity : Entity) -> Bool

    ComponentStore::for_each

    fn[T] ComponentStore::for_each(self : ComponentStore[T], f : (Entity, T) -> Unit) -> Unit

    ComponentStore::for_each_added

    fn[T] ComponentStore::for_each_added(self : ComponentStore[T], system : SystemTicks, f : (Entity, T) -> Unit) -> Unit

    ComponentStore::for_each_changed

    fn[T] ComponentStore::for_each_changed(self : ComponentStore[T], system : SystemTicks, f : (Entity, T) -> Unit) -> Unit

    ComponentStore::get

    fn[T] ComponentStore::get(self : ComponentStore[T], entity : Entity) -> T?

    ComponentStore::get_ticks

    fn[T] ComponentStore::get_ticks(self : ComponentStore[T], entity : Entity) -> ComponentTicks?

    ComponentStore::insert

    fn[T] ComponentStore::insert(self : ComponentStore[T], entity : Entity, value : T, change_tick : Int) -> Unit

    ComponentStore::len

    fn[T] ComponentStore::len(self : ComponentStore[T]) -> Int

    ComponentStore::new

    fn[T] ComponentStore::new() -> ComponentStore[T]

    ComponentStore::remove

    fn[T] ComponentStore::remove(self : ComponentStore[T], entity : Entity) -> T?

    ComponentStore::set

    fn[T] ComponentStore::set(self : ComponentStore[T], entity : Entity, value : T, change_tick : Int) -> Bool

    ComponentTicks

    pub struct ComponentTicks {
    added : Int
    changed : Int
    }

    ComponentTicks::is_added

    fn ComponentTicks::is_added(self : ComponentTicks, system : SystemTicks) -> Bool

    ComponentTicks::is_changed

    fn ComponentTicks::is_changed(self : ComponentTicks, system : SystemTicks) -> Bool

    ComponentTicks::new

    fn ComponentTicks::new(change_tick : Int) -> ComponentTicks

    ComponentTicks::set_changed

    fn ComponentTicks::set_changed(self : ComponentTicks, change_tick : Int) -> Unit

    Entities

    type Entities

    Entities::despawn

    fn Entities::despawn(self : Entities, entity : Entity) -> Unit raise EntityError

    Entities::is_alive

    fn Entities::is_alive(self : Entities, entity : Entity) -> Bool

    Entities::len

    fn Entities::len(self : Entities) -> Int

    Entities::new

    fn Entities::new() -> Entities

    Entities::spawn

    fn Entities::spawn(self : Entities) -> Entity

    Entity

    pub struct Entity {
    id : Int
    generation : Int
    }

    Entity::is_placeholder

    fn Entity::is_placeholder(self : Entity) -> Bool

    Entity::new

    fn Entity::new(id : Int, generation : Int) -> Entity

    Entity::placeholder

    fn Entity::placeholder() -> Entity

    Resource

    pub struct Resource[T] {
    cell : Ref[T]?
    ticks : ComponentTicks
    }

    Resource::get

    fn[T] Resource::get(self : Resource[T]) -> T?

    Resource::get_ref

    fn[T] Resource::get_ref(self : Resource[T]) -> Ref[T]?

    Resource::get_ref_mut

    fn[T] Resource::get_ref_mut(self : Resource[T], change_tick : Int) -> Ref[T]?

    Resource::insert

    fn[T] Resource::insert(self : Resource[T], value : T, change_tick : Int) -> Unit

    Resource::is_present

    fn[T] Resource::is_present(self : Resource[T]) -> Bool

    Resource::new

    fn[T] Resource::new() -> Resource[T]

    Resource::remove

    fn[T] Resource::remove(self : Resource[T]) -> T?

    Resource::ticks

    fn[T] Resource::ticks(self : Resource[T]) -> ComponentTicks

    SparseSet

    type SparseSet[T]

    SparseSet::contains

    fn[T] SparseSet::contains(self : SparseSet[T], entity : Entity) -> Bool

    SparseSet::entity_at

    fn[T] SparseSet::entity_at(self : SparseSet[T], dense_index : Int) -> Entity

    SparseSet::get

    fn[T] SparseSet::get(self : SparseSet[T], entity : Entity) -> T?

    SparseSet::index_of

    fn[T] SparseSet::index_of(self : SparseSet[T], entity : Entity) -> Int?

    SparseSet::insert

    fn[T] SparseSet::insert(self : SparseSet[T], entity : Entity, value : T) -> Unit

    SparseSet::is_empty

    fn[T] SparseSet::is_empty(self : SparseSet[T]) -> Bool

    SparseSet::len

    fn[T] SparseSet::len(self : SparseSet[T]) -> Int

    SparseSet::new

    fn[T] SparseSet::new() -> SparseSet[T]

    SparseSet::remove

    fn[T] SparseSet::remove(self : SparseSet[T], entity : Entity) -> T?

    SparseSet::set

    fn[T] SparseSet::set(self : SparseSet[T], entity : Entity, value : T) -> Bool

    SparseSet::value_at

    fn[T] SparseSet::value_at(self : SparseSet[T], dense_index : Int) -> T

    SystemContext

    pub struct SystemContext {
    last_run : Int
    this_run : Int
    }

    SystemContext::new

    SystemContext::set

    fn SystemContext::set(self : SystemContext, system : SystemTicks) -> Unit

    SystemContext::ticks

    SystemTicks

    pub struct SystemTicks {
    last_run : Int
    this_run : Int
    }

    SystemTicks::new

    fn SystemTicks::new(last_run : Int, this_run : Int) -> SystemTicks

    World

    type World

    World::despawn

    fn World::despawn(self : World, entity : Entity) -> Unit raise EntityError

    World::is_alive

    fn World::is_alive(self : World, entity : Entity) -> Bool

    World::new

    fn World::new() -> World

    World::spawn_empty

    fn World::spawn_empty(self : World) -> Entity

    query2

    fn[A, B] query2(a : ComponentStore[A], b : ComponentStore[B], f : (Entity, A, B) -> Unit) -> Unit

    query2_changed_a

    fn[A, B] query2_changed_a(a : ComponentStore[A], b : ComponentStore[B], system : SystemTicks, f : (Entity, A, B) -> Unit) -> Unit

    with_host_bytes_id

    fn[T] with_host_bytes_id(data : Bytes, f : (Int) -> T) -> T

    with_host_string_id

    fn[T] with_host_string_id(text : String, f : (Int) -> T) -> T