Exemple #1
0
        private void SkipAnimation()
        {
            t.Stop();

            if (currentCtx != null)
            {
                currentCtx.Dispose();
            }
            this.currentCtx = endingContext.Clone();
            if (secondaryCtx != null)
            {
                secondaryCtx.Dispose();
                this.secondaryCtx = null;
            }
            if (startingContext != null)
            {
                startingContext.Dispose();
                startingContext = null;
            }
            if (endingContext != null)
            {
                endingContext.Dispose();
                endingContext = null;
            }
            this.animating = false;

            this.Invalidate();
        }
Exemple #2
0
        // Animation support
        private void StartAnimation(GfxContext startContext, GfxContext endContext)
        {
            if (animating) // If already animating
            {
                if (endContext != null)
                {
                    endingContext = endContext.Clone();
                }
                SkipAnimation(); // jumps to end without animating
                return;
            }

            // Check input
            if (endContext == null)
            {
                endContext          = new GfxContext(); // empty context (paint black)
                endContext.destSize = NativeResolution.Size;
                endContext.opacity  = -255;
            }
            if (startContext == null)
            {
                startContext                 = new GfxContext();
                startContext.destSize        = NativeResolution.Size;
                startContext.animTextOpacity = 0;
            }

            // Check image to correct ramp
            if (startContext.img == null)
            {
                startContext.img     = endContext.img;
                startContext.opacity = -255;
            }
            if (endContext.img == null)
            {
                endContext.img     = startContext.img;
                endContext.opacity = -255;
            }

            // Release previous resources
            if (startingContext != null)
            {
                startingContext.Dispose();
            }
            if (endingContext != null)
            {
                endingContext.Dispose();
            }

            // Adjust animation duration and choke
            if (startContext.animTextOpacity == 0 || endContext.animTextOpacity == 0)
            {
                animationDuration = 10;
                animationChoke    = 0;
            }
            else
            {
                animationDuration = 20;
                animationChoke    = 7;
            }

            this.animating       = true;
            this.startingContext = startContext.Clone();
            this.endingContext   = endContext.Clone();
            t.Start();
        }