Add the concept of skinnable target containers and mark a basic one for HUD elements

This commit is contained in:
Dean Herbert
2021-05-07 19:13:38 +09:00
parent 67ea4a7e97
commit 95a8f21ab2
11 changed files with 154 additions and 36 deletions

View File

@ -45,6 +45,15 @@ namespace osu.Game.Extensions
public static Vector2 ScreenSpaceDeltaToParentSpace(this Drawable drawable, Vector2 delta) =>
drawable.Parent.ToLocalSpace(drawable.Parent.ToScreenSpace(Vector2.Zero) + delta);
public static StoredSkinnableInfo CreateSerialisedInformation(this Drawable component) => new StoredSkinnableInfo(component);
public static SkinnableInfo CreateSerialisedInformation(this Drawable component) => new SkinnableInfo(component);
public static void ApplySerialisedInformation(this Drawable component, ISkinnableInfo info)
{
// todo: can probably make this better via deserialisation directly using a common interface.
component.Position = info.Position;
component.Rotation = info.Rotation;
component.Scale = info.Scale;
component.Anchor = info.Anchor;
}
}
}