1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 04:53:29 +01:00

make the documentation for the custom draw group better

This commit is contained in:
Ellpeck 2019-09-08 21:31:11 +02:00
parent c1c7b7a9b1
commit b87bb01a80

View file

@ -211,10 +211,12 @@ namespace Demos {
private IEnumerator<Wait> WobbleButton(CustomDrawGroup group) {
var counter = 0F;
while (counter < 4 * Math.PI) {
// The important bit is that it changes its added display scale and offset, allowing the button to still maintain the
// correct position and scaling for both anchoring and interacting purposes, but to show any kind of animation visually
// This could be useful, for example, to create a little feedback effect to clicking it where it changes size for a second
// note that other changes can be applied to a custom draw group, like MG effects and so on
// A custom draw group allows the implementation of any sort of custom rendering for all of its child components
// This includes simply changing the transform matrix like here, but also applying custom effects and doing
// anything else that can be done in the SpriteBatch's Begin call.
// Note that changing visual features like this
// has no effect on the ui's actual interaction behavior (mouse position interpretation, for example), but it can
// be a great way to accomplish feedback animations for buttons and so on.
group.Transform = Matrix.CreateTranslation((float) Math.Sin(counter / 2) * 10 * group.Scale, 0, 0);
counter += 0.1F;
yield return new WaitSeconds(0.01F);