1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

cleaned up changes from f1d686f0c0

This commit is contained in:
Ellpeck 2020-07-16 15:55:55 +02:00
parent f94802271b
commit 02cd074a3c
2 changed files with 5 additions and 7 deletions

View file

@ -395,8 +395,6 @@ namespace MLEM.Ui.Elements {
this.anchor = anchor;
this.size = size;
// force BeginImpl to be reset to the default
this.BeginImpl = null;
this.OnMouseEnter += element => this.IsMouseOver = true;
this.OnMouseExit += element => this.IsMouseOver = false;
this.OnTouchEnter += element => this.IsMouseOver = true;
@ -833,7 +831,7 @@ namespace MLEM.Ui.Elements {
/// <param name="blendState">The blend state that is used for drawing</param>
/// <param name="samplerState">The sampler state that is used for drawing</param>
/// <param name="matrix">The transformation matrix that is used for drawing</param>
public void DrawAll(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) {
public void DrawTransformed(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) {
var transform = this.Transform ?? this.TransformGetter(this, time, matrix);
var customDraw = this.BeginImpl != null || transform != Matrix.Identity;
var mat = matrix * transform;
@ -874,7 +872,7 @@ namespace MLEM.Ui.Elements {
foreach (var child in this.GetRelevantChildren()) {
if (!child.IsHidden)
child.DrawAll(time, batch, alpha * child.DrawAlpha, blendState, samplerState, matrix);
child.DrawTransformed(time, batch, alpha * child.DrawAlpha, blendState, samplerState, matrix);
}
}
@ -1011,7 +1009,7 @@ namespace MLEM.Ui.Elements {
public delegate Element GamepadNextElementCallback(Direction2 dir, Element usualNext);
/// <summary>
/// A delegate method used for <see cref="CustomDrawGroup.BeginImpl"/>
/// A delegate method used for <see cref="BeginImpl"/>
/// </summary>
/// <param name="element">The custom draw group</param>
/// <param name="time">The game's time</param>
@ -1023,7 +1021,7 @@ namespace MLEM.Ui.Elements {
public delegate void BeginDelegate(Element element, GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix);
/// <summary>
/// A delegate method used for <see cref="CustomDrawGroup.TransformGetter"/>
/// A delegate method used for <see cref="TransformGetter"/>
/// </summary>
/// <param name="element">The element whose transform to get</param>
/// <param name="time">The game's time</param>

View file

@ -260,7 +260,7 @@ namespace MLEM.Ui {
continue;
batch.Begin(SpriteSortMode.Deferred, this.BlendState, this.SamplerState, null, null, null, root.Transform);
var alpha = this.DrawAlpha * root.Element.DrawAlpha;
root.Element.DrawAll(time, batch, alpha, this.BlendState, this.SamplerState, root.Transform);
root.Element.DrawTransformed(time, batch, alpha, this.BlendState, this.SamplerState, root.Transform);
batch.End();
}
}