summaryrefslogtreecommitdiff
path: root/engine/Components/World/Tile.go
blob: 203d40d1073f9e28ec51338e2f98e8b9007bea39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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"`
}