From ed888621948f7b186903e42a902dd8cf58cf1929 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 2 Feb 2022 18:17:53 +0100 Subject: [PATCH] Marked BeginDelegate and BeginImpl as obsolete --- CHANGELOG.md | 1 + MLEM.Ui/Elements/Element.cs | 6 ++++++ MLEM.Ui/Style/StyleProp.cs | 2 ++ 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6cb4cf..b5cbdb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Fixes Removals - Marked StyleProp equality members as obsolete +- Marked BeginDelegate and BeginImpl as obsolete ### MLEM.Extended Improvements diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index c5c30ab..0de46fa 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -183,7 +183,10 @@ namespace MLEM.Ui.Elements { /// The call that this element should make to to begin drawing. /// Note that, when this is non-null, a new call is used for this element. /// + #pragma warning disable CS0618 + [Obsolete("BeginImpl is deprecated. You can create a custom element class and override DrawEarly or Draw instead.")] public BeginDelegate BeginImpl; + #pragma warning restore CS0618 /// /// Set this field to false to disallow the element from being selected. /// An unselectable element is skipped by automatic navigation and its callback will never be called. @@ -922,6 +925,7 @@ namespace MLEM.Ui.Elements { /// The depth stencil state that is used for drawing /// The transformation matrix that is used for drawing public void DrawTransformed(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, Effect effect, Matrix matrix) { + #pragma warning disable CS0618 var customDraw = this.BeginImpl != null || this.Transform != Matrix.Identity; var mat = this.Transform * matrix; // TODO ending and beginning again when the matrix changes isn't ideal (https://github.com/MonoGame/MonoGame/issues/3156) @@ -935,6 +939,7 @@ namespace MLEM.Ui.Elements { batch.Begin(SpriteSortMode.Deferred, blendState, samplerState, depthStencilState, null, effect, mat); } } + #pragma warning restore CS0618 // draw content in custom begin call this.Draw(time, batch, alpha, blendState, samplerState, depthStencilState, effect, mat); @@ -1163,6 +1168,7 @@ namespace MLEM.Ui.Elements { /// The effect used for drawing /// The depth stencil state used for drawing /// The transform matrix used for drawing + [Obsolete("BeginDelegate is deprecated. You can create a custom element class and override DrawEarly or Draw instead.")] public delegate void BeginDelegate(Element element, GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, Effect effect, Matrix matrix); } diff --git a/MLEM.Ui/Style/StyleProp.cs b/MLEM.Ui/Style/StyleProp.cs index 21db659..3458e50 100644 --- a/MLEM.Ui/Style/StyleProp.cs +++ b/MLEM.Ui/Style/StyleProp.cs @@ -84,6 +84,7 @@ namespace MLEM.Ui.Style { /// The object to compare with the current instance. /// true if obj and this instance are the same type and represent the same value; otherwise, false. [Obsolete("StyleProp equality is ambiguous as it is not clear whether priority is taken into account. Compare Values instead.")] + #pragma warning disable CS0809 public override bool Equals(object obj) { return obj is StyleProp other && this.Equals(other); } @@ -94,6 +95,7 @@ namespace MLEM.Ui.Style { public override int GetHashCode() { return EqualityComparer.Default.GetHashCode(this.Value); } + #pragma warning restore CS0809 /// Returns the fully qualified type name of this instance. /// The fully qualified type name.