module Codec.Tiled.Tileset.Tile
( Tile(..)
, empty
) where
import Data.Text (Text)
import Data.Vector (Vector)
import GHC.Generics (Generic)
import Codec.Tiled.Aeson (FromJSON(..), ToJSON(..), genericParseJSON, genericToJSON)
import Codec.Tiled.Layer (Layer)
import Codec.Tiled.Property (Property)
import Codec.Tiled.Tileset.Frame (Frame)
data Tile = Tile
{ Tile -> Maybe (Vector Frame)
animation :: Maybe (Vector Frame)
, Tile -> Int
id :: Int
, Tile -> Maybe FilePath
image :: Maybe FilePath
, Tile -> Int
imageHeight :: Int
, Tile -> Int
imageWidth :: Int
, Tile -> Maybe Layer
objectGroup :: Maybe Layer
, Tile -> Maybe Double
probability :: Maybe Double
, Tile -> Maybe (Vector Property)
properties :: Maybe (Vector Property)
, Tile -> Maybe (Vector Int)
terrain :: Maybe (Vector Int)
, Tile -> Maybe Text
type_ :: Maybe Text
}
deriving (Tile -> Tile -> Bool
(Tile -> Tile -> Bool) -> (Tile -> Tile -> Bool) -> Eq Tile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Tile -> Tile -> Bool
$c/= :: Tile -> Tile -> Bool
== :: Tile -> Tile -> Bool
$c== :: Tile -> Tile -> Bool
Eq, Int -> Tile -> ShowS
[Tile] -> ShowS
Tile -> FilePath
(Int -> Tile -> ShowS)
-> (Tile -> FilePath) -> ([Tile] -> ShowS) -> Show Tile
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
showList :: [Tile] -> ShowS
$cshowList :: [Tile] -> ShowS
show :: Tile -> FilePath
$cshow :: Tile -> FilePath
showsPrec :: Int -> Tile -> ShowS
$cshowsPrec :: Int -> Tile -> ShowS
Show, (forall x. Tile -> Rep Tile x)
-> (forall x. Rep Tile x -> Tile) -> Generic Tile
forall x. Rep Tile x -> Tile
forall x. Tile -> Rep Tile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Tile x -> Tile
$cfrom :: forall x. Tile -> Rep Tile x
Generic)
instance FromJSON Tile where
parseJSON :: Value -> Parser Tile
parseJSON = Value -> Parser Tile
forall a. (Generic a, GFromJSON Zero (Rep a)) => Value -> Parser a
genericParseJSON
instance ToJSON Tile where
toJSON :: Tile -> Value
toJSON = Tile -> Value
forall a. (Generic a, GToJSON' Value Zero (Rep a)) => a -> Value
genericToJSON
empty :: Tile
empty :: Tile
empty = Tile :: Maybe (Vector Frame)
-> Int
-> Maybe FilePath
-> Int
-> Int
-> Maybe Layer
-> Maybe Double
-> Maybe (Vector Property)
-> Maybe (Vector Int)
-> Maybe Text
-> Tile
Tile
{ animation :: Maybe (Vector Frame)
animation = Maybe (Vector Frame)
forall a. Maybe a
Nothing
, id :: Int
id = Int
0
, image :: Maybe FilePath
image = Maybe FilePath
forall a. Maybe a
Nothing
, imageHeight :: Int
imageHeight = Int
0
, imageWidth :: Int
imageWidth = Int
0
, objectGroup :: Maybe Layer
objectGroup = Maybe Layer
forall a. Maybe a
Nothing
, probability :: Maybe Double
probability = Maybe Double
forall a. Maybe a
Nothing
, properties :: Maybe (Vector Property)
properties = Maybe (Vector Property)
forall a. Maybe a
Nothing
, terrain :: Maybe (Vector Int)
terrain = Maybe (Vector Int)
forall a. Maybe a
Nothing
, type_ :: Maybe Text
type_ = Maybe Text
forall a. Maybe a
Nothing
}