1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-23 17:13:38 +02:00

added some more element events

This commit is contained in:
Ellpeck 2019-09-25 16:47:19 +02:00
parent 026b79b61e
commit ae4ced1cc1

View file

@ -69,6 +69,8 @@ namespace MLEM.Ui.Elements {
public Rectangle ChildPaddedArea => this.UnscrolledArea.Shrink(this.ScaledChildPadding);
public Point ScaledChildPadding => this.childPadding.Multiply(this.Scale);
public DrawCallback OnDrawn;
public TimeCallback OnUpdated;
public GenericCallback OnPressed;
public GenericCallback OnSecondaryPressed;
public GenericCallback OnSelected;
@ -420,6 +422,8 @@ namespace MLEM.Ui.Elements {
}
public virtual void Update(GameTime time) {
this.System.OnElementUpdated?.Invoke(this, time);
foreach (var child in this.GetRelevantChildren())
child.Update(time);
}
@ -470,6 +474,8 @@ namespace MLEM.Ui.Elements {
public delegate void DrawCallback(Element element, GameTime time, SpriteBatch batch, float alpha);
public delegate void TimeCallback(Element element, GameTime time);
public delegate Element TabNextElementCallback(bool backward, Element usualNext);
public delegate Element GamepadNextElementCallback(Direction2 dir, Element usualNext);