Commit graph

71 commits

Author SHA1 Message Date
Stephen Gutekanst
eae5aa40be module: correct Objects.is() checker
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-12-24 18:05:34 -07:00
Stephen Gutekanst
5ed75fb3ee module: remove error-prone "optimized" function variants for now
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-12-24 17:02:36 -07:00
Stephen Gutekanst
15c3f772ef module: perform type checking of object IDs to avoid subtle bugs
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-12-24 17:00:39 -07:00
Stephen Gutekanst
a28b9798a8 module: improve error message for use-after-delete of objects
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-12-24 16:51:23 -07:00
Stephen Gutekanst
b33f85576e object: fix dead object recycling
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-12-01 13:55:30 -07:00
Stephen Gutekanst
6dd7b48662 module: add getFirstChildOfType helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-12-01 13:55:30 -07:00
Stephen Gutekanst
cddebeb01f object: fix Objects.is() function
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-12-01 13:55:30 -07:00
Stephen Gutekanst
58d9c378ca object: fix Objects.Slice delete/get/set methods
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-12-01 13:55:30 -07:00
Colton Franklin
1fe47b2b19
obj: Move Platform and InitOptions fields into core.windows (#1309)
* obj: Make field tracking use a single bitset

* obj: module: fix comment

* obj: Move `Platform` state and `InitOptions` fields into `core.windows`, initial push, only triangle example working on macos currently

* obj: `get` and `getValue` (renamed `getAll`) now do not return optionals, comment revisions, `device` is no longer optional, `native` is optional

* core: Lots of cleanup of unnecessary comments

* core: `Event`s now all contain `window_id`, darwin/windows: event functions now send window id

* core: comments, examples: fix `core-custom-entrypoint`
2024-11-30 15:13:14 -07:00
Stephen Gutekanst
b4e2da1b69 object: fix Modules().init error
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-11-30 14:49:55 -07:00
foxnne
40dcef1836 obj: module: fix comment 2024-11-30 08:29:10 -07:00
foxnne
797f8f7a58 obj: Make field tracking use a single bitset 2024-11-30 08:29:10 -07:00
Emi Gutekanst
a43ffcacc2 object: clarify comment 2024-11-27 18:30:53 -07:00
foxnne
27ec56a4cc obj: Better type handling 2024-11-27 18:30:53 -07:00
foxnne
863b1def16 obj: Fix comment 2024-11-27 18:30:53 -07:00
foxnne
0546c3d5ca obj: Refine comments, make updated set bits back to false, swap Objects parameters 2024-11-27 18:30:53 -07:00
foxnne
f58cb270b1 obj: Fix doc comment and update example to build 2024-11-27 18:30:53 -07:00
foxnne
0476999dc4 core: Allow tracking of individual struct fields for changes 2024-11-27 18:30:53 -07:00
Stephen Gutekanst
ae1d49b51a object: add TODO; fix non-aarch64 macos builds
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-11-23 21:20:04 -07:00
Stephen Gutekanst
714f200bc1 module: implement cross-Object-pool graph relations
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-11-23 21:20:04 -07:00
Stephen Gutekanst
59bbea454a module: update to latest Zig + unify object ID validation/unpacking
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-11-23 21:20:04 -07:00
Stephen Gutekanst
9d134dc72d module: object recycling
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-11-23 21:20:04 -07:00
Stephen Gutekanst
8054d03b4d unify mach.Call and mach.Runner into one type
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-11-23 21:20:04 -07:00
Stephen Gutekanst
0e12857154 examples/core: building without ECS
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-11-23 21:20:04 -07:00
Stephen Gutekanst
f578e1f5e2 {module,ecs}: Mach ECS becomes the Mach' module system
This moves the bulk of the ECS code into `src/module`. It also makes
types like `mach.ecs.EntityID` accessible at the top-level `mach.EntityID`
instead.

The motivation of this change is to make the Mach module system a
first-class property of Mach.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
679a05faf4 ecs: refactor comptime.zig -> Archetype.zig
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
af3c1e9155 module: remove dispatchNoError, better loop implementation
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
5812409078 module: document loop intention, fix test
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
95331ebf8f module: basic event docs
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
4b9379707c module: cleanup TODOs
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
0148b931ca module: make sendToModule the default name for sending events
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
cf883f5544 module: change state to avoid undefined, remove global allocator
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
5dbf9ece3b module: do not expose list of modules
Doing so would encourage accidentally creating dependency loops.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
b4a479fb3f module: basic event handler parameter validation
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
3ea64966f0 module: remove TupleHACK now that dependency loop is resolved
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
b3663f7899 module: enable Module to analyze event handler signatures
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
2115f5832a module: write components using a struct pattern
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
17db5498ee module: write module events using a struct pattern
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
582a3c07f6 module: elevate local/global args type construction
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
8711e5e3a7 module: rename MComponentTypes -> ComponentTypesM (consistency with LocalArgsM, etc.)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
e6a170a07a module: remove NamespacedState; module state is literally its struct type
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
17c751a2e7 module: improve variable naming slightly
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
f55aee4b50 module: rename MComponents -> MComponentTypes
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
a83f9d5be8 module: rename NamespacedComponents -> ComponentTypesByName
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
2e7cb30bc9 module: invert switch case for hypothetically better branch prediction
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
ea14480246 module: improve isString, add tests
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
0328598945 module: merge ecs/systems.zig -> module.zig
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
e847d46ff9 module: begin making Mod unaware of all namespaced components
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
7e0b9dde68 module: components are written in the same style as events
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00
Stephen Gutekanst
f50a27b83d module: update tests for sendGlobal changes
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-06 15:18:38 -07:00