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

added easy scale origin function to custom draw groups

This commit is contained in:
Ellpeck 2020-03-18 16:47:14 +01:00
parent 739d337d49
commit cb56319924

View file

@ -42,6 +42,10 @@ namespace MLEM.Ui.Elements {
} }
} }
public void ScaleOrigin(float scale, Vector2? origin = null) {
this.Transform = Matrix.CreateScale(scale, scale, 0) * Matrix.CreateTranslation(new Vector3((1 - scale) * (origin ?? this.DisplayArea.Center), 0));
}
public delegate void BeginDelegate(CustomDrawGroup element, GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix); public delegate void BeginDelegate(CustomDrawGroup element, GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix);
public delegate Matrix TransformCallback(CustomDrawGroup element, GameTime time, Matrix matrix); public delegate Matrix TransformCallback(CustomDrawGroup element, GameTime time, Matrix matrix);