pituicat/src/Types/GameMap.hs

53 lines
1.6 KiB
Haskell
Raw Normal View History

2020-10-09 23:00:33 +00:00
module Types.GameMap where
2020-10-06 02:19:07 +00:00
import Data.Vector
import Linear
2020-10-12 04:08:33 +00:00
-- internal imports
import Types.Texture
2020-10-06 02:19:07 +00:00
data LevelMap = LevelMap
2020-10-09 03:51:00 +00:00
{ mapLayers :: Vector MapLayer -- | Layer stack
, mapWalkLayer :: Word -- | Collision layer index in stack
, mapDimensions :: V2 Word -- | Dimension of map in tiles
, mapTileMap :: TileMap -- | The tile map
, mapStartPos :: V2 Word -- | Player start position
2020-10-06 02:19:07 +00:00
}
deriving (Eq, Show)
newtype MapLayer = MapLayer
2020-10-09 03:51:00 +00:00
{ layerTiles :: Vector Tile -- | Tiles of this layer
2020-10-06 02:19:07 +00:00
}
deriving (Eq, Show)
data Tile = Tile
2020-10-09 23:00:33 +00:00
{ tileOffset :: V2 Word -- | Offset of this tile on the tile map
2020-10-09 03:51:00 +00:00
, tileType :: TileType -- | Type of tile
2020-10-06 02:19:07 +00:00
}
deriving (Eq, Show)
data TileType
2020-10-09 23:00:33 +00:00
= Solid
2020-10-06 02:19:07 +00:00
| Platform
| Decoration
deriving (Enum, Ord, Eq, Show)
data TileMap = TileMap
2020-10-09 03:51:00 +00:00
{ tileMapDimensions :: V2 Word -- | Dimensions of tile map image in pixels
2020-10-12 04:08:33 +00:00
, tileMapTecture :: Texture -- | Texture object on GPU
2020-10-06 02:19:07 +00:00
}
2020-10-09 23:00:33 +00:00
deriving (Eq, Show)
2020-10-09 03:51:00 +00:00
data LevelDescriptor = LevelDescriptor
2020-10-09 23:00:33 +00:00
{ levelLayerPath :: [(Word, FilePath)] -- | Indexed paths to the layers
2020-10-09 03:51:00 +00:00
, levelWalkLayer :: Word -- | Index of walk layer
, levelTileMap :: FilePath -- | Filepath to tile map
2020-10-09 23:00:33 +00:00
, levelStartPos :: (Word, Word) -- | Player start position
2020-10-09 03:51:00 +00:00
-- , 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)