@@ -33,6 +33,9 @@ module StaticSpriteFacetExtensions =
3333 member this.GetInsetOpt world : Box2 option = this.Get ( nameof this.InsetOpt) world
3434 member this.SetInsetOpt ( value : Box2 option ) world = this.Set ( nameof this.InsetOpt) value world
3535 member this.InsetOpt = lens ( nameof this.InsetOpt) this this.GetInsetOpt this.SetInsetOpt
36+ member this.GetClipOpt world : Box2 option = this.Get ( nameof this.ClipOpt) world
37+ member this.SetClipOpt ( value : Box2 option ) world = this.Set ( nameof this.ClipOpt) value world
38+ member this.ClipOpt = lens ( nameof this.ClipOpt) this this.GetClipOpt this.SetClipOpt
3639 member this.GetStaticImage world : Image AssetTag = this.Get ( nameof this.StaticImage) world
3740 member this.SetStaticImage ( value : Image AssetTag ) world = this.Set ( nameof this.StaticImage) value world
3841 member this.StaticImage = lens ( nameof this.StaticImage) this this.GetStaticImage this.SetStaticImage
@@ -55,6 +58,7 @@ type StaticSpriteFacet () =
5558
5659 static member Properties =
5760 [ define Entity.InsetOpt None
61+ define Entity.ClipOpt None
5862 define Entity.StaticImage Assets.Default.StaticSprite
5963 define Entity.Color Color.One
6064 define Entity.Blend Transparent
@@ -65,7 +69,7 @@ type StaticSpriteFacet () =
6569 let mutable transform = entity.GetTransform world
6670 let staticImage = entity.GetStaticImage world
6771 let insetOpt = match entity.GetInsetOpt world with Some inset -> ValueSome inset | None -> ValueNone
68- let clipOpt = ValueNone : Box2 voption
72+ let clipOpt = entity.GetClipOpt world |> Option.toValueOption
6973 let color = entity.GetColor world
7074 let blend = entity.GetBlend world
7175 let emission = entity.GetEmission world
@@ -130,6 +134,7 @@ type AnimatedSpriteFacet () =
130134 define Entity.AnimationDelay ( GameTime.ofSeconds ( 1.0 f / 15.0 f))
131135 define Entity.AnimationStride 1
132136 define Entity.AnimationSheet Assets.Default.AnimatedSprite
137+ define Entity.ClipOpt None
133138 define Entity.Color Color.One
134139 define Entity.Blend Transparent
135140 define Entity.Emission Color.Zero
@@ -143,7 +148,7 @@ type AnimatedSpriteFacet () =
143148 let mutable transform = entity.GetTransform world
144149 let animationSheet = entity.GetAnimationSheet world
145150 let insetOpt = match getSpriteInsetOpt entity world with Some inset -> ValueSome inset | None -> ValueNone
146- let clipOpt = ValueNone : Box2 voption
151+ let clipOpt = entity.GetClipOpt world |> Option.toValueOption
147152 let color = entity.GetColor world
148153 let blend = entity.GetBlend world
149154 let emission = entity.GetEmission world
@@ -1687,6 +1692,7 @@ type TileMapFacet () =
16871692 define Entity.CollisionCategories " 1"
16881693 define Entity.CollisionMask Constants.Physics.CollisionWildcard
16891694 define Entity.PhysicsMotion SynchronizedMotion
1695+ define Entity.ClipOpt None
16901696 define Entity.Color Color.One
16911697 define Entity.Emission Color.Zero
16921698 define Entity.TileLayerClearance 2.0 f
@@ -1758,6 +1764,7 @@ type TileMapFacet () =
17581764 viewBounds
17591765 perimeterUnscaled.Min.V2
17601766 transform.Elevation
1767+ ( entity.GetClipOpt world |> Option.toValueOption)
17611768 ( entity.GetColor world)
17621769 ( entity.GetEmission world)
17631770 ( entity.GetTileLayerClearance world)
@@ -1792,6 +1799,7 @@ type TmxMapFacet () =
17921799 define Entity.CollisionCategories " 1"
17931800 define Entity.CollisionMask Constants.Physics.CollisionWildcard
17941801 define Entity.PhysicsMotion SynchronizedMotion
1802+ define Entity.ClipOpt None
17951803 define Entity.Color Color.One
17961804 define Entity.Emission Color.Zero
17971805 define Entity.TileLayerClearance 2.0 f
@@ -1860,6 +1868,7 @@ type TmxMapFacet () =
18601868 viewBounds
18611869 perimeterUnscaled.Min.V2
18621870 transform.Elevation
1871+ ( entity.GetClipOpt world |> Option.toValueOption)
18631872 ( entity.GetColor world)
18641873 ( entity.GetEmission world)
18651874 ( entity.GetTileLayerClearance world)
0 commit comments