diff options
Diffstat (limited to 'engine/Components/World/Tile.go')
| -rw-r--r-- | engine/Components/World/Tile.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/engine/Components/World/Tile.go b/engine/Components/World/Tile.go new file mode 100644 index 0000000..203d40d --- /dev/null +++ b/engine/Components/World/Tile.go @@ -0,0 +1,31 @@ +package world + +import rl "github.com/gen2brain/raylib-go/raylib" + +// The square that will be displayed at the screen +type Tile interface { + Update() + Draw() +} + +type StandardTile struct { + X float32 + Y float32 + ParentWorld *World + Descriptor TileDescriptor +} + +func (base *StandardTile) Update() { +} + +func (base *StandardTile) Draw() { + rl.DrawTexture(base.ParentWorld.Textures[base.Descriptor.TextureId], + int32(base.X) * int32(base.ParentWorld.TileSize.X), + int32(base.Y) * int32(base.ParentWorld.TileSize.Y), + rl.White) +} + + +type TileDescriptor struct { + TextureId int `json:"textureid"` +} |
