Commit graph

40 commits

Author SHA1 Message Date
Stephen Gutekanst
7ac5bef717 module: add dispatchUntil helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-08-24 22:33:15 -07:00
Ali Cheraghi
266e7a548b core: refactor 2024-07-13 09:06:35 -07:00
Stephen Gutekanst
316f2354d1 mach: add centralized is_debug flag
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-06-16 10:05:08 -07:00
Stephen Gutekanst
707e5cc756 update to Zig 2024.05
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-06-02 18:57:45 -07:00
Stephen Gutekanst
13ff5097db module: fix potential archetype hash collision lookup issues
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-26 18:04:08 -07:00
Stephen Gutekanst
aa0ec4ba5e module: remove archetypeByID, improve "entity does not exist" error cases
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-24 13:42:29 -07:00
Stephen Gutekanst
07e61fde30 module: bump eval branch quota on ComponentName
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-12 14:25:59 +02:00
Stephen Gutekanst
8578613adc module: fix ECS alignment issues caught only on Windows
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-11 14:22:48 -07:00
Stephen Gutekanst
10f35a49ef module: fix swap removal bug, improve code clarity
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-09 17:37:17 -07:00
Stephen Gutekanst
22ac26b57e module: rename events -> systems, remove 'event arguments'
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-08 13:39:07 -07:00
Stephen Gutekanst
83d436ffa4 module: remove "global events" concept
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-08 13:39:07 -07:00
Stephen Gutekanst
8d669537dc module: make adding/removing components/entities legal during query iteration
This makes adding/removing components and entities legal during the execution
of a query iterator. Previously, this could invalidate the iterator slices at
worst leading to UB. This fixes the issue by deferring all such actions until
after no queries are pending (i.e. all iterators have finished running)

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
57767c2f9f module: remove deprecated query API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
541ce9e7c0 all: rename mach.Entity.Mod -> mach.Entities.Mod
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
11ebce62a3 module: rename Entities -> Database
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
2b6aea7d91 module: add query() method to injectable *mach.Entities.Mod
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
65e2168b9f module: injected mach.Entity.Mod for global entity operations
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
69ff2e027f all: rename mod.entities -> mod.__entities (private)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
3bd46d078d module: add new query API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
22feb42730 module: denote const vs. mut component queries
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
7d033ca2cf module: rename query2 -> query
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
2e8926d6fa module: rename query -> queryDeprecated
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-07 23:40:56 -07:00
Stephen Gutekanst
26b2351d4b module: fix zero-size component bug
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-06 14:03:57 -07:00
Stephen Gutekanst
1b65702ae8 module: add test for zero-size component bug
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-06 14:03:57 -07:00
Stephen Gutekanst
261f94d3bc module: begin improved query implementation
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-06 14:03:57 -07:00
Stephen Gutekanst
2075959dad module: refactor: pass modules through Entities comptime logic
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-06 14:03:57 -07:00
Stephen Gutekanst
95c9ae5278 module: support merging module lists
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-06 14:03:57 -07:00
Stephen Gutekanst
b37ece1b9a module: rename all_components -> component_types_by_name
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-06 14:03:57 -07:00
Stephen Gutekanst
fc0ff2fffd all: rename local_events -> events
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-29 20:17:26 -07:00
Stephen Gutekanst
33bfdee520 {module,Audio}: ability to store event name and send it later
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-29 20:17:26 -07:00
Stephen Gutekanst
656b0202f2 Core: add .present_frame event replacing swapbuffers call
Note that on e.g. web platform, swapbuffers is not an explicit call.
We also need a signal that the frame has been submitted and finished,
and this is it.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-29 20:17:26 -07:00
Stephen Gutekanst
2bc17a33fb module: correct alignment of dispatched arguments; move stack space to caller
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-19 18:05:17 -07:00
Stephen Gutekanst
80780054b5 module: fix removeComponent, add TODO about stack space
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-16 19:14:37 -07:00
Stephen Gutekanst
8e3f9e21e1 module: add MACH_DEBUG_TRACE option to get logs of event dispatch order
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-16 10:39:35 -07:00
Stephen Gutekanst
c32c1df00a module: improve validation of missing mod name
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-08 23:49:38 -07:00
Stephen Gutekanst
c46d949b98 module: improve "cannot inject argument" error message
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-07 22:37:59 -07:00
Stephen Gutekanst
9cfbe86b0f module: fix missing injected argument check
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-07 13:58:02 -07:00
Stephen Gutekanst
393a3e5e5e module: add check for missing injected arguments
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-07 13:54:46 -07:00
Stephen Gutekanst
34030faa9d module: fix local_events validation
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-07 13:54:26 -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