expand on types
This commit is contained in:
parent
bb364d6b1a
commit
a1144db6d9
9
src/Map.hs
Normal file
9
src/Map.hs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module Map where
|
||||||
|
|
||||||
|
import Linear
|
||||||
|
|
||||||
|
-- internal imports
|
||||||
|
|
||||||
|
import Types
|
||||||
|
|
||||||
|
|
|
@ -5,21 +5,22 @@ import Data.Vector
|
||||||
import Linear
|
import Linear
|
||||||
|
|
||||||
data LevelMap = LevelMap
|
data LevelMap = LevelMap
|
||||||
{ mapLayers :: Vector MapLayer
|
{ mapLayers :: Vector MapLayer -- | Layer stack
|
||||||
, mapWalkLayer :: Word
|
, mapWalkLayer :: Word -- | Collision layer index in stack
|
||||||
, mapDimensions :: V2 Word
|
, mapDimensions :: V2 Word -- | Dimension of map in tiles
|
||||||
, mapTileMap :: TileMap
|
, mapTileMap :: TileMap -- | The tile map
|
||||||
|
, mapStartPos :: V2 Word -- | Player start position
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
newtype MapLayer = MapLayer
|
newtype MapLayer = MapLayer
|
||||||
{ layerTiles :: Vector Tile
|
{ layerTiles :: Vector Tile -- | Tiles of this layer
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
data Tile = Tile
|
data Tile = Tile
|
||||||
{ tileOffset :: V2 Float
|
{ tileOffset :: V2 Float -- | Offset of this tile on the tile map
|
||||||
, tileType :: TileType
|
, tileType :: TileType -- | Type of tile
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
|
@ -30,7 +31,18 @@ data TileType
|
||||||
deriving (Enum, Ord, Eq, Show)
|
deriving (Enum, Ord, Eq, Show)
|
||||||
|
|
||||||
data TileMap = TileMap
|
data TileMap = TileMap
|
||||||
{ tileMapDimensions :: V2 Word
|
{ tileMapDimensions :: V2 Word -- | Dimensions of tile map image in pixels
|
||||||
, tileMapPath :: FilePath
|
, tileMapPath :: FilePath -- | Filepath to image
|
||||||
, tileMapIndex :: Word
|
, tileMapIndex :: Word -- | Index on GPU
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data LevelDescriptor = LevelDescriptor
|
||||||
|
{ levelLayerPath :: [(Word, FilePath)] -- | Indexed paths aths to the layers
|
||||||
|
, levelWalkLayer :: Word -- | Index of walk layer
|
||||||
|
, levelTileMap :: FilePath -- | Filepath to tile map
|
||||||
|
, levelStartPos .. (Word, Word) -- | Player start position
|
||||||
|
-- , levelCollectibles :: [(V2 Word, ())] -- | TODO; Collectibles and their tile coords
|
||||||
|
-- , levelEnemies :: [(V2 Word, ())] -- | TODO: Enemies and their tile coords
|
||||||
|
-- , levelInteractables :: [(V2 Word, ())] -- | TODO: Interactables and their coords
|
||||||
|
}
|
||||||
|
deriving (Eq, Show)
|
||||||
|
|
Loading…
Reference in a new issue