{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedLists #-} module Area ( Area(..) , Key(..) , dex ) where import Data.Aeson (ToJSON(..), FromJSON(..), genericParseJSON, genericToEncoding, defaultOptions) import Data.Vector (Vector) import GHC.Generics (Generic) import Area.Tile (Content(..), Tile(..), Terrain(..)) import Area.Climate (Climate(..)) data Area = Area { matrix :: Vector (Vector Tile) } deriving (Generic) instance ToJSON Area where toEncoding = genericToEncoding defaultOptions instance FromJSON Area where parseJSON = genericParseJSON defaultOptions newtype Key = Key Int deriving (Generic) instance ToJSON Key where toEncoding = genericToEncoding defaultOptions instance FromJSON Key where parseJSON = genericParseJSON defaultOptions dex :: Vector Area dex = [ Area { matrix = [ [ground, ground] , [ground, water] ] } ] where ground = Tile { terrain = Normal , skin = "tiles/ground.png" , climate = Mild , content = Empty } water = Tile { terrain = Water , skin = "tiles/water.png" , climate = Mild , content = Empty }