summaryrefslogtreecommitdiff
path: root/engine/Components
diff options
context:
space:
mode:
authorphyscik <mynameisgennadiy@vk.com>2026-04-06 18:29:34 +0500
committerphyscik <mynameisgennadiy@vk.com>2026-04-06 18:29:34 +0500
commite211798077de88fe39d1e1c0add7a0f460d1da5a (patch)
treede3163568818116a2ca43d31c66947d918cea2fd /engine/Components
parente75d107899617446add49f00fb03837cb46d2543 (diff)
Experimental async update functionHEADmain
Diffstat (limited to 'engine/Components')
-rw-r--r--engine/Components/World.go11
1 files changed, 9 insertions, 2 deletions
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()
}