Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides Haskell types for Tiled's JSON exports, which you can read about at http://doc.mapeditor.org/en/latest/reference/json-map-format/. That said - as of the writing of this module the JSON documentation does not cover some of the types and records that are available in the format. For those you should read the TMX documentation at http://doc.mapeditor.org/en/latest/reference/tmx-map-format/
Synopsis
- data Tiledmap = Tiledmap {
- tiledmapVersion :: Version
- tiledmapTiledversion :: Version
- tiledmapWidth :: Int
- tiledmapHeight :: Int
- tiledmapTilewidth :: Double
- tiledmapTileheight :: Double
- tiledmapOrientation :: Orientation
- tiledmapLayers :: Vector Layer
- tiledmapTilesets :: Vector Tileset
- tiledmapBackgroundcolor :: Maybe Text
- tiledmapRenderorder :: Text
- tiledmapProperties :: Map Text Text
- tiledmapNextobjectid :: Int
- data Orientation
- data Version
- newtype TransitiveTilesetMap = TransitiveTilesetMap (Map LocalId Value)
- data Tileset = Tileset {
- tilesetFirstgid :: GlobalId
- tilesetImage :: FilePath
- tilesetName :: Text
- tilesetTilewidth :: Int
- tilesetTileheight :: Int
- tilesetImagewidth :: Int
- tilesetImageheight :: Int
- tilesetProperties :: Map Text Text
- tilesetPropertytypes :: Map Text Text
- tilesetMargin :: Int
- tilesetSpacing :: Int
- tilesetTileproperties :: Map GlobalId (Map Text Text)
- tilesetTerrains :: Vector Terrain
- tilesetColumns :: Int
- tilesetTilecount :: Int
- tilesetTiles :: Map LocalId Tile
- data Tile = Tile {}
- data Frame = Frame {}
- data Terrain = Terrain {}
- data Layer = Layer {
- layerWidth :: Double
- layerHeight :: Double
- layerName :: Text
- layerType :: Text
- layerVisible :: Bool
- layerX :: Double
- layerY :: Double
- layerData :: Maybe (Vector GlobalId)
- layerObjects :: Maybe (Vector Object)
- layerProperties :: Map Text Text
- layerOpacity :: Float
- layerDraworder :: Text
- data Object = Object {
- objectId :: Int
- objectWidth :: Double
- objectHeight :: Double
- objectName :: Text
- objectType :: Text
- objectProperties :: Map Text Text
- objectVisible :: Bool
- objectX :: Double
- objectY :: Double
- objectRotation :: Float
- objectGid :: Maybe GlobalId
- objectEllipse :: Bool
- objectPolygon :: Maybe (Vector (Double, Double))
- objectPolyline :: Maybe (Vector (Double, Double))
- objectText :: Map Text Text
- data XYPair a = XYPair a a
- newtype LocalId = LocalId {}
- newtype GlobalId = GlobalId {
- unGlobalId :: Int
- fromXYPair :: XYPair a -> (a, a)
- toXYPair :: (a, a) -> XYPair a
- omitNulls :: Value -> Value
- parseDefault :: FromJSON a => Object -> Key -> a -> Parser a
- parseTiles :: Object -> Parser (Map LocalId Tile)
- loadTiledmap :: FilePath -> IO (Either String Tiledmap)
- data Map k a
- data Vector a
Tiled map editor types, their aeson instances and map loading
The full monty.
Tiledmap | |
|
Instances
data Orientation Source #
Instances
Instances
Eq Version Source # | |
Ord Version Source # | |
Show Version Source # | |
Generic Version Source # | |
ToJSON Version Source # | |
Defined in Data.Aeson.Tiled | |
FromJSON Version Source # | |
type Rep Version Source # | |
Defined in Data.Aeson.Tiled type Rep Version = D1 ('MetaData "Version" "Data.Aeson.Tiled" "aeson-tiled-0.0.1.0-KU3uXBRozgPALUcYPXCaUr" 'False) (C1 ('MetaCons "VersionFloat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float)) :+: C1 ('MetaCons "VersionText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) |
newtype TransitiveTilesetMap Source #
Instances
Tileset | |
|
Instances
Instances
Eq Tile Source # | |
Show Tile Source # | |
Generic Tile Source # | |
ToJSON Tile Source # | |
Defined in Data.Aeson.Tiled | |
FromJSON Tile Source # | |
type Rep Tile Source # | |
Defined in Data.Aeson.Tiled type Rep Tile = D1 ('MetaData "Tile" "Data.Aeson.Tiled" "aeson-tiled-0.0.1.0-KU3uXBRozgPALUcYPXCaUr" 'False) (C1 ('MetaCons "Tile" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tileId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalId) :*: S1 ('MetaSel ('Just "tileProperties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text Text))) :*: (S1 ('MetaSel ('Just "tileImage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Value)) :*: (S1 ('MetaSel ('Just "tileObjectGroup") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Vector Object))) :*: S1 ('MetaSel ('Just "tileAnimation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Vector Frame))))))) |
Frame | |
|
Instances
Eq Frame Source # | |
Show Frame Source # | |
Generic Frame Source # | |
ToJSON Frame Source # | |
Defined in Data.Aeson.Tiled | |
FromJSON Frame Source # | |
type Rep Frame Source # | |
Defined in Data.Aeson.Tiled type Rep Frame = D1 ('MetaData "Frame" "Data.Aeson.Tiled" "aeson-tiled-0.0.1.0-KU3uXBRozgPALUcYPXCaUr" 'False) (C1 ('MetaCons "Frame" 'PrefixI 'True) (S1 ('MetaSel ('Just "frameDuration") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "frameTileId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalId))) |
Terrain | |
|
Instances
Eq Terrain Source # | |
Show Terrain Source # | |
Generic Terrain Source # | |
ToJSON Terrain Source # | |
Defined in Data.Aeson.Tiled | |
FromJSON Terrain Source # | |
type Rep Terrain Source # | |
Defined in Data.Aeson.Tiled type Rep Terrain = D1 ('MetaData "Terrain" "Data.Aeson.Tiled" "aeson-tiled-0.0.1.0-KU3uXBRozgPALUcYPXCaUr" 'False) (C1 ('MetaCons "Terrain" 'PrefixI 'True) (S1 ('MetaSel ('Just "terrainName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "terrainTile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalId))) |
Layer | |
|
Instances
Object | |
|
Instances
XYPair a a |
A locally indexed identifier.
Instances
Enum LocalId Source # | |
Eq LocalId Source # | |
Num LocalId Source # | |
Ord LocalId Source # | |
Show LocalId Source # | |
Generic LocalId Source # | |
ToJSON LocalId Source # | |
Defined in Data.Aeson.Tiled | |
ToJSONKey LocalId Source # | |
Defined in Data.Aeson.Tiled | |
FromJSON LocalId Source # | |
FromJSONKey LocalId Source # | |
Defined in Data.Aeson.Tiled | |
type Rep LocalId Source # | |
Defined in Data.Aeson.Tiled |
A globally indexed identifier.
Instances
Enum GlobalId Source # | |
Eq GlobalId Source # | |
Num GlobalId Source # | |
Ord GlobalId Source # | |
Defined in Data.Aeson.Tiled | |
Show GlobalId Source # | |
Generic GlobalId Source # | |
ToJSON GlobalId Source # | |
Defined in Data.Aeson.Tiled | |
ToJSONKey GlobalId Source # | |
Defined in Data.Aeson.Tiled | |
FromJSON GlobalId Source # | |
FromJSONKey GlobalId Source # | |
Defined in Data.Aeson.Tiled | |
type Rep GlobalId Source # | |
Defined in Data.Aeson.Tiled |
fromXYPair :: XYPair a -> (a, a) Source #
loadTiledmap :: FilePath -> IO (Either String Tiledmap) Source #
Load a Tiled map from the given FilePath
.
Re-exports for working with Tiled types
A Map from keys k
to values a
.
The Semigroup
operation for Map
is union
, which prefers
values from the left operand. If m1
maps a key k
to a value
a1
, and m2
maps the same key to a different value a2
, then
their union m1 <> m2
maps k
to a1
.
Instances
Eq2 Map | Since: containers-0.5.9 |
Ord2 Map | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
Show2 Map | Since: containers-0.5.9 |
Hashable2 Map | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
Functor (Map k) | |
Foldable (Map k) | Folds in order of increasing key. |
Defined in Data.Map.Internal fold :: Monoid m => Map k m -> m # foldMap :: Monoid m => (a -> m) -> Map k a -> m # foldMap' :: Monoid m => (a -> m) -> Map k a -> m # foldr :: (a -> b -> b) -> b -> Map k a -> b # foldr' :: (a -> b -> b) -> b -> Map k a -> b # foldl :: (b -> a -> b) -> b -> Map k a -> b # foldl' :: (b -> a -> b) -> b -> Map k a -> b # foldr1 :: (a -> a -> a) -> Map k a -> a # foldl1 :: (a -> a -> a) -> Map k a -> a # elem :: Eq a => a -> Map k a -> Bool # maximum :: Ord a => Map k a -> a # minimum :: Ord a => Map k a -> a # | |
Traversable (Map k) | Traverses in order of increasing key. |
ToJSONKey k => ToJSON1 (Map k) | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> Map k a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Map k a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Map k a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Map k a] -> Encoding # | |
(FromJSONKey k, Ord k) => FromJSON1 (Map k) | |
Eq k => Eq1 (Map k) | Since: containers-0.5.9 |
Ord k => Ord1 (Map k) | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
(Ord k, Read k) => Read1 (Map k) | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
Show k => Show1 (Map k) | Since: containers-0.5.9 |
Hashable k => Hashable1 (Map k) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
Ord k => IsList (Map k v) | Since: containers-0.5.6.2 |
(Eq k, Eq a) => Eq (Map k a) | |
(Data k, Data a, Ord k) => Data (Map k a) | |
Defined in Data.Map.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Map k a -> c (Map k a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Map k a) # toConstr :: Map k a -> Constr # dataTypeOf :: Map k a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Map k a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k a)) # gmapT :: (forall b. Data b => b -> b) -> Map k a -> Map k a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Map k a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Map k a -> r # gmapQ :: (forall d. Data d => d -> u) -> Map k a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Map k a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # | |
(Ord k, Ord v) => Ord (Map k v) | |
(Ord k, Read k, Read e) => Read (Map k e) | |
(Show k, Show a) => Show (Map k a) | |
Ord k => Semigroup (Map k v) | |
Ord k => Monoid (Map k v) | |
(Hashable k, Hashable v) => Hashable (Map k v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
(ToJSON v, ToJSONKey k) => ToJSON (Map k v) | |
Defined in Data.Aeson.Types.ToJSON | |
(FromJSONKey k, Ord k, FromJSON v) => FromJSON (Map k v) | |
(NFData k, NFData a) => NFData (Map k a) | |
Defined in Data.Map.Internal | |
type Item (Map k v) | |
Defined in Data.Map.Internal |
Boxed vectors, supporting efficient slicing.
Instances
Monad Vector | |
Functor Vector | |
MonadFix Vector | Instance has same semantics as one for lists Since: vector-0.12.2.0 |
Defined in Data.Vector | |
MonadFail Vector | Since: vector-0.12.1.0 |
Defined in Data.Vector | |
Applicative Vector | |
Foldable Vector | |
Defined in Data.Vector fold :: Monoid m => Vector m -> m # foldMap :: Monoid m => (a -> m) -> Vector a -> m # foldMap' :: Monoid m => (a -> m) -> Vector a -> m # foldr :: (a -> b -> b) -> b -> Vector a -> b # foldr' :: (a -> b -> b) -> b -> Vector a -> b # foldl :: (b -> a -> b) -> b -> Vector a -> b # foldl' :: (b -> a -> b) -> b -> Vector a -> b # foldr1 :: (a -> a -> a) -> Vector a -> a # foldl1 :: (a -> a -> a) -> Vector a -> a # elem :: Eq a => a -> Vector a -> Bool # maximum :: Ord a => Vector a -> a # minimum :: Ord a => Vector a -> a # | |
Traversable Vector | |
ToJSON1 Vector | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> Vector a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Vector a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Vector a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Vector a] -> Encoding # | |
FromJSON1 Vector | |
Alternative Vector | |
MonadPlus Vector | |
Eq1 Vector | |
Ord1 Vector | |
Defined in Data.Vector | |
Read1 Vector | |
Defined in Data.Vector | |
Show1 Vector | |
MonadZip Vector | |
NFData1 Vector | Since: vector-0.12.1.0 |
Defined in Data.Vector | |
Vector Vector a | |
Defined in Data.Vector basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) a -> m (Vector a) # basicUnsafeThaw :: PrimMonad m => Vector a -> m (Mutable Vector (PrimState m) a) # basicLength :: Vector a -> Int # basicUnsafeSlice :: Int -> Int -> Vector a -> Vector a # basicUnsafeIndexM :: Monad m => Vector a -> Int -> m a # basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) a -> Vector a -> m () # | |
IsList (Vector a) | |
Eq a => Eq (Vector a) | |
Data a => Data (Vector a) | |
Defined in Data.Vector gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Vector a -> c (Vector a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Vector a) # toConstr :: Vector a -> Constr # dataTypeOf :: Vector a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Vector a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Vector a)) # gmapT :: (forall b. Data b => b -> b) -> Vector a -> Vector a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Vector a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Vector a -> r # gmapQ :: (forall d. Data d => d -> u) -> Vector a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Vector a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) # | |
Ord a => Ord (Vector a) | |
Defined in Data.Vector | |
Read a => Read (Vector a) | |
Show a => Show (Vector a) | |
Semigroup (Vector a) | |
Monoid (Vector a) | |
ToJSON a => ToJSON (Vector a) | |
Defined in Data.Aeson.Types.ToJSON | |
FromJSON a => FromJSON (Vector a) | |
NFData a => NFData (Vector a) | |
Defined in Data.Vector | |
type Mutable Vector | |
Defined in Data.Vector | |
type Item (Vector a) | |
Defined in Data.Vector |