From e211798077de88fe39d1e1c0add7a0f460d1da5a Mon Sep 17 00:00:00 2001 From: physcik Date: Mon, 6 Apr 2026 18:29:34 +0500 Subject: Experimental async update function --- engine/Components/World.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'engine/Components') diff --git a/engine/Components/World.go b/engine/Components/World.go index c7a96df..ccbe99f 100644 --- a/engine/Components/World.go +++ b/engine/Components/World.go @@ -13,27 +13,34 @@ type World struct { StaticObjects []coreobjects.GameObject Player *Player - Camera *rl.Camera2D - layersStatic layering // ========== Cache ========== // the collection of the colliders that belong to static objects - world, buildings, etc staticColliders []*coreobjects.Collider + + updateQueue []coreobjects.UpdateFunction } func (base *World) Create(manager *coreobjects.SceneManager) { base.Manager = manager base.Player.Init(manager) + // The max length will be higher but this length is guaranteed + base.updateQueue = make([]coreobjects.UpdateFunction, 0, len(base.StaticObjects)) for _, v := range base.StaticObjects { v.Init(manager) + base.updateQueue = append(base.updateQueue, v.Update) } base.layersStatic = layering{} base.generateStaticLayers() } +func (base *World) GetUpdateFunctions() []coreobjects.UpdateFunction { + return base.updateQueue +} + func (base *World) Destroy() { base.Player.Destroy() } -- cgit v1.3