mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:07:25 +08:00
Fix storyboard sprite flipping.
This commit is contained in:
parent
3f2598543c
commit
e4a2ad5eb5
@ -3,6 +3,7 @@
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Animations;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using System.Linq;
|
||||
@ -18,7 +19,35 @@ namespace osu.Game.Storyboards.Drawables
|
||||
|
||||
public bool FlipH { get; set; }
|
||||
public bool FlipV { get; set; }
|
||||
protected override Vector2 DrawScale => new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y);
|
||||
|
||||
protected override Vector2 DrawScale
|
||||
=> new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y);
|
||||
|
||||
public override Anchor Origin
|
||||
{
|
||||
get
|
||||
{
|
||||
var origin = base.Origin;
|
||||
|
||||
if (FlipH)
|
||||
{
|
||||
if (origin.HasFlag(Anchor.x0))
|
||||
origin = Anchor.x2 | (origin & (Anchor.y0 | Anchor.y1 | Anchor.y2));
|
||||
else if (origin.HasFlag(Anchor.x2))
|
||||
origin = Anchor.x0 | (origin & (Anchor.y0 | Anchor.y1 | Anchor.y2));
|
||||
}
|
||||
|
||||
if (FlipV)
|
||||
{
|
||||
if (origin.HasFlag(Anchor.y0))
|
||||
origin = Anchor.y2 | (origin & (Anchor.x0 | Anchor.x1 | Anchor.x2));
|
||||
else if (origin.HasFlag(Anchor.y2))
|
||||
origin = Anchor.y0 | (origin & (Anchor.x0 | Anchor.x1 | Anchor.x2));
|
||||
}
|
||||
|
||||
return origin;
|
||||
}
|
||||
}
|
||||
|
||||
public StoryboardAnimation(AnimationDefinition definition)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using System.Linq;
|
||||
@ -18,7 +19,35 @@ namespace osu.Game.Storyboards.Drawables
|
||||
|
||||
public bool FlipH { get; set; }
|
||||
public bool FlipV { get; set; }
|
||||
protected override Vector2 DrawScale => new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y);
|
||||
|
||||
protected override Vector2 DrawScale
|
||||
=> new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y);
|
||||
|
||||
public override Anchor Origin
|
||||
{
|
||||
get
|
||||
{
|
||||
var origin = base.Origin;
|
||||
|
||||
if (FlipH)
|
||||
{
|
||||
if (origin.HasFlag(Anchor.x0))
|
||||
origin = Anchor.x2 | (origin & (Anchor.y0 | Anchor.y1 | Anchor.y2));
|
||||
else if (origin.HasFlag(Anchor.x2))
|
||||
origin = Anchor.x0 | (origin & (Anchor.y0 | Anchor.y1 | Anchor.y2));
|
||||
}
|
||||
|
||||
if (FlipV)
|
||||
{
|
||||
if (origin.HasFlag(Anchor.y0))
|
||||
origin = Anchor.y2 | (origin & (Anchor.x0 | Anchor.x1 | Anchor.x2));
|
||||
else if (origin.HasFlag(Anchor.y2))
|
||||
origin = Anchor.y0 | (origin & (Anchor.x0 | Anchor.x1 | Anchor.x2));
|
||||
}
|
||||
|
||||
return origin;
|
||||
}
|
||||
}
|
||||
|
||||
public StoryboardSprite(SpriteDefinition definition)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user