// Shapes © Freya Holmér - https://twitter.com/FreyaHolmer/ // Website & Documentation - https://acegikmo.com/shapes/ using System.Runtime.CompilerServices; namespace Shapes { public static partial class Draw { // initialize all default values static Draw() => ResetAllDrawStates(); /// Resets all static states - both style & matrix public static void ResetAllDrawStates() { ResetMatrix(); ResetStyle(); } /// using( StateStack ){ /*code*/ } lets you modify the draw state within that scope, automatically restoring the previous state once you leave the scope public static StateStack Scope => new StateStack( Draw.style, Draw.matrix ); /// Pushes the current draw state onto the stack. Calling will restore the saved state state [MethodImpl( INLINE )]public static void Push() => StateStack.Push( Draw.style, Draw.matrix ); /// Restores the draw state to the previously pushed state from the stack [MethodImpl( INLINE )]public static void Pop() => StateStack.Pop(); } }