more types

This commit is contained in:
nek0 2020-10-06 04:19:07 +02:00
parent 0c53c11942
commit 12b788af5e
3 changed files with 48 additions and 3 deletions

View file

@ -11,10 +11,11 @@ import qualified Data.Map.Strict as M
-- internal imports
import Types.Subsystems
import Types.LevelMap
data GameData = GameData
{ gameState :: TVar State
-- , gameCurrentLevel :: Tvar Level
, gameStateData :: StateData
, gameSubsystems :: Subsystems
, gameActionTranslation :: TVar ActionTranslation
, gameRunning :: TVar Bool
@ -61,3 +62,8 @@ data Level
deriving (Enum, Eq, Show)
type ActionTranslation = M.Map SDL.Keycode Action
data GameStateData
= TestData
{ testMap :: LevelMap
}

36
src/Types/GameMap.hs Normal file
View file

@ -0,0 +1,36 @@
module Types.LevelMap where
import Data.Vector
import Linear
data LevelMap = LevelMap
{ mapLayers :: Vector MapLayer
, mapWalkLayer :: Word
, mapDimensions :: V2 Word
, mapTileMap :: TileMap
}
deriving (Eq, Show)
newtype MapLayer = MapLayer
{ layerTiles :: Vector Tile
}
deriving (Eq, Show)
data Tile = Tile
{ tileOffset :: V2 Float
, tileType :: TileType
}
deriving (Eq, Show)
data TileType
= Wall
| Platform
| Decoration
deriving (Enum, Ord, Eq, Show)
data TileMap = TileMap
{ tileMapDimensions :: V2 Word
, tileMapPath :: FilePath
, tileMapIndex :: Word
}

View file

@ -1,5 +1,7 @@
module Types.Map where
import qualified Data.Matrix as Mat
import Linear
data Map = Map
@ -7,7 +9,8 @@ data Map = Map
, mapStart :: (Word, V2 Word) -- | (Layer index, Position)
}
data Layer = Layer
{
type Layer = Mat.Matrix Tile
type Tile = V2 Float
type LayerDescriptor = FilePath