Add Glyph methods to convert to a glyph
This commit is contained in:
parent
53d6ad08d9
commit
acdd019093
2 changed files with 38 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
|||
package atlas
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/mdiluz/rove/pkg/maths"
|
||||
)
|
||||
|
||||
|
@ -21,6 +23,23 @@ const (
|
|||
TileSand = Tile(GlyphSand)
|
||||
)
|
||||
|
||||
// Glyph returns the glyph for this tile type
|
||||
func (t Tile) Glyph() Glyph {
|
||||
switch t {
|
||||
case TileNone:
|
||||
return GlyphNone
|
||||
case TileRock:
|
||||
return GlyphRock
|
||||
case TileGravel:
|
||||
return GlyphGravel
|
||||
case TileSand:
|
||||
return GlyphSand
|
||||
}
|
||||
|
||||
log.Fatalf("Unknown tile type: %c", t)
|
||||
return GlyphNone
|
||||
}
|
||||
|
||||
// Atlas represents a 2D world atlas of tiles and objects
|
||||
type Atlas interface {
|
||||
// SetTile sets a location on the Atlas to a type of tile
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue