summaryrefslogtreecommitdiff
path: root/engine/Components/World
diff options
context:
space:
mode:
authorPhyscik <mynameisgennadiy@vk.com>2026-01-10 17:27:55 +0500
committerPhyscik <mynameisgennadiy@vk.com>2026-01-10 17:27:55 +0500
commita364d4330dfd34f953f64e90020f8b8d6f2e82c4 (patch)
treedb71d125f633832b130821f3aec07d4b714ab7bb /engine/Components/World
parente6ccb74f77d0d03d33c422ca7dc942422074d7dd (diff)
World storage system change
Diffstat (limited to 'engine/Components/World')
-rw-r--r--engine/Components/World/Descriptor.go29
-rw-r--r--engine/Components/World/Tile.go12
-rw-r--r--engine/Components/World/World.go11
3 files changed, 11 insertions, 41 deletions
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 {