more types
This commit is contained in:
parent
0c53c11942
commit
12b788af5e
|
@ -11,10 +11,11 @@ import qualified Data.Map.Strict as M
|
||||||
-- internal imports
|
-- internal imports
|
||||||
|
|
||||||
import Types.Subsystems
|
import Types.Subsystems
|
||||||
|
import Types.LevelMap
|
||||||
|
|
||||||
data GameData = GameData
|
data GameData = GameData
|
||||||
{ gameState :: TVar State
|
{ gameState :: TVar State
|
||||||
-- , gameCurrentLevel :: Tvar Level
|
, gameStateData :: StateData
|
||||||
, gameSubsystems :: Subsystems
|
, gameSubsystems :: Subsystems
|
||||||
, gameActionTranslation :: TVar ActionTranslation
|
, gameActionTranslation :: TVar ActionTranslation
|
||||||
, gameRunning :: TVar Bool
|
, gameRunning :: TVar Bool
|
||||||
|
@ -61,3 +62,8 @@ data Level
|
||||||
deriving (Enum, Eq, Show)
|
deriving (Enum, Eq, Show)
|
||||||
|
|
||||||
type ActionTranslation = M.Map SDL.Keycode Action
|
type ActionTranslation = M.Map SDL.Keycode Action
|
||||||
|
|
||||||
|
data GameStateData
|
||||||
|
= TestData
|
||||||
|
{ testMap :: LevelMap
|
||||||
|
}
|
||||||
|
|
36
src/Types/GameMap.hs
Normal file
36
src/Types/GameMap.hs
Normal 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
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
module Types.Map where
|
module Types.Map where
|
||||||
|
|
||||||
|
import qualified Data.Matrix as Mat
|
||||||
|
|
||||||
import Linear
|
import Linear
|
||||||
|
|
||||||
data Map = Map
|
data Map = Map
|
||||||
|
@ -7,7 +9,8 @@ data Map = Map
|
||||||
, mapStart :: (Word, V2 Word) -- | (Layer index, Position)
|
, mapStart :: (Word, V2 Word) -- | (Layer index, Position)
|
||||||
}
|
}
|
||||||
|
|
||||||
data Layer = Layer
|
type Layer = Mat.Matrix Tile
|
||||||
{
|
|
||||||
|
type Tile = V2 Float
|
||||||
|
|
||||||
type LayerDescriptor = FilePath
|
type LayerDescriptor = FilePath
|
||||||
|
|
Loading…
Reference in a new issue