Move glyph definitions into a central type

This commit is contained in:
Marc Di Luzio 2020-07-19 11:46:37 +01:00
parent 0e731df1a3
commit a0b811a659
3 changed files with 34 additions and 7 deletions

View file

@ -9,16 +9,16 @@ type Tile byte
const (
// TileNone is a keyword for nothing
TileNone = Tile(0)
TileNone = Tile(GlyphNone)
// TileRock is solid rock ground
TileRock = Tile('-')
TileRock = Tile(GlyphRock)
// TileGravel is loose rocks
TileGravel = Tile(':')
TileGravel = Tile(GlyphGravel)
// TileSand is sand
TileSand = Tile('~')
TileSand = Tile(GlyphSand)
)
// Atlas represents a 2D world atlas of tiles and objects

27
pkg/atlas/glyph.go Normal file
View file

@ -0,0 +1,27 @@
package atlas
// Glyph represents the text representation of something in the game
type Glyph byte
const (
// GlyphNone is a keyword for nothing
GlyphNone = Glyph(0)
// GlyphRock is solid rock ground
GlyphRock = Glyph('-')
// GlyphGravel is loose rocks
GlyphGravel = Glyph(':')
// GlyphSand is sand
GlyphSand = Glyph('~')
// GlyphRover represents a live rover
GlyphRover = Glyph('R')
// GlyphSmallRock is a small stashable rock
GlyphSmallRock = Glyph('o')
// GlyphLargeRock is a large blocking rock
GlyphLargeRock = Glyph('O')
)

View file

@ -6,13 +6,13 @@ type Type byte
// Types of objects
const (
// ObjectNone represents no object at all
ObjectNone = Type(0)
ObjectNone = Type(GlyphNone)
// ObjectRover represents a live rover
ObjectRover = Type('R')
ObjectRover = Type(GlyphRover)
// ObjectSmallRock is a small stashable rock
ObjectSmallRock = Type('o')
ObjectSmallRock = Type(GlyphSmallRock)
// ObjectLargeRock is a large blocking rock
ObjectLargeRock = Type('O')