From 4c614ef14ebf4c3cd16c1e96283dc3763b9b0d0a Mon Sep 17 00:00:00 2001 From: Physcik Date: Sun, 11 Jan 2026 20:43:46 +0500 Subject: World rendering --- engine/Dynamic/Descriptors/World.go | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'engine/Dynamic/Descriptors/World.go') diff --git a/engine/Dynamic/Descriptors/World.go b/engine/Dynamic/Descriptors/World.go index 5116a0d..25e52ef 100644 --- a/engine/Dynamic/Descriptors/World.go +++ b/engine/Dynamic/Descriptors/World.go @@ -1,6 +1,9 @@ package descriptors -import rl "github.com/gen2brain/raylib-go/raylib" +import ( + components "github.com/DegustatorPonos/RuinesOfRafdolon/Components" + rl "github.com/gen2brain/raylib-go/raylib" +) type WorldDescriptor struct { Name string @@ -26,3 +29,30 @@ type FloorPiece struct { Position rl.Vector2 Texture string } + +// Transforms the world descriptor into the game world +func (base WorldDescriptor) Parse() components.World { + var outp = components.World { + Name: base.Name, + Floor: make([]components.FloorTile, 0, len(base.FloorMap)), + + Camera: &rl.Camera2D{ + Offset: rl.Vector2 {X: 0, Y: 0}, + Target: rl.Vector2 {X: 0, Y: 0}, + Rotation: 0, + Zoom: 1, + }, + } + for _, v := range base.FloorMap { + var texture, textureErr = components.Resources.Textures.GetTextureByName(v.Texture) + if textureErr != nil { + continue + } + var new = components.FloorTile { + Position: v.Position, + Texture: texture, + } + outp.Floor = append(outp.Floor, new) + } + return outp +} -- cgit v1.3