NateTheGreatt / bitECS

Flexible, minimal, data-oriented ECS library for Typescript
Mozilla Public License 2.0
944 stars 84 forks source link

Apply function #29

Closed SupremeTechnopriest closed 3 years ago

SupremeTechnopriest commented 3 years ago

Apply function returns the BitECS API with world partially applied:

import { createWorld, apply } from 'bitecs'

const world = createWorld()
const { addEntity, defineComponent, addComponent, ...restOfTheBitECSAPI } = apply(world)

const tag = defineComponent()
const eid = addEntity()

addComponent(tag, eid)

Also added typedefs for missing exported functions and properties. This is untested, but I will try it out in Bokeh.

SupremeTechnopriest commented 3 years ago

Going to roll this into the typescript port. Closing this for now, but feature coming soon!