From a364d4330dfd34f953f64e90020f8b8d6f2e82c4 Mon Sep 17 00:00:00 2001 From: Physcik Date: Sat, 10 Jan 2026 17:27:55 +0500 Subject: World storage system change --- engine/Components/World/Descriptor.go | 29 ----------------------------- engine/Components/World/Tile.go | 12 +++++------- engine/Components/World/World.go | 11 ++++++----- 3 files changed, 11 insertions(+), 41 deletions(-) delete mode 100644 engine/Components/World/Descriptor.go (limited to 'engine/Components/World') diff --git a/engine/Components/World/Descriptor.go b/engine/Components/World/Descriptor.go deleted file mode 100644 index 553aa5b..0000000 --- a/engine/Components/World/Descriptor.go +++ /dev/null @@ -1,29 +0,0 @@ -package world - -import rl "github.com/gen2brain/raylib-go/raylib" - -type Descriptor struct { - TileSize rl.Vector2 - Textures map[int]string `json:"textures"` - WorldMap [][]TileDescriptor `json:"worldmap"` -} - -func (base *Descriptor) GenerateMap() *World { - var outp = &World { - TileSize: base.TileSize, - TextureNames: base.Textures, - Tiles: make([][]Tile, len(base.WorldMap)), - } - for x := range base.WorldMap { - outp.Tiles[x] = make([]Tile, len(base.WorldMap[x])) - for y, tile := range base.WorldMap[x] { - outp.Tiles[x][y] = &StandardTile { - X: float32(x), - Y: float32(y), - ParentWorld: outp, - Descriptor: tile, - } - } - } - return outp -} diff --git a/engine/Components/World/Tile.go b/engine/Components/World/Tile.go index a630062..0ef3a00 100644 --- a/engine/Components/World/Tile.go +++ b/engine/Components/World/Tile.go @@ -1,6 +1,9 @@ package world -import rl "github.com/gen2brain/raylib-go/raylib" +import ( + descriptors "github.com/DegustatorPonos/RuinesOfRafdolon/Dynamic/Descriptors" + rl "github.com/gen2brain/raylib-go/raylib" +) // The square that will be displayed at the screen type Tile interface { @@ -12,7 +15,7 @@ type StandardTile struct { X float32 Y float32 ParentWorld *World - Descriptor TileDescriptor + Descriptor descriptors.TileDescriptor } func (base *StandardTile) Update() { @@ -34,8 +37,3 @@ func (base *StandardTile) Draw() { rl.White) } } - -type TileDescriptor struct { - TextureId int `json:"textureid"` - OveralyTextureId int `json:"overalytextureid"` -} diff --git a/engine/Components/World/World.go b/engine/Components/World/World.go index 80ef7e9..d360adc 100644 --- a/engine/Components/World/World.go +++ b/engine/Components/World/World.go @@ -9,11 +9,12 @@ var Texture rl.Texture2D // The scene full of tiles type World struct { - TileSize rl.Vector2 - TextureNames map[int]string - Textures map[int]rl.Texture2D - Tiles [][]Tile - Camera rl.Camera2D + Name string `json:"name"` + TileSize rl.Vector2 `json:"tilesize"` + TextureNames map[int]string `json:"textures"` + Textures map[int]rl.Texture2D `json:"-"` + Tiles [][]Tile `json:"tiles"` + Camera rl.Camera2D `json:"-"` } func (base *World) IsValid() error { -- cgit v1.3