module Codec.Tiled.Tileset.Tile 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