public override void update(IComponent component)
        {
            TitleComponent title = component as TitleComponent;

            if (!initialized)
            {
                resetTitle(title);
                initializeTitle(title);
                initialized = true;
            }

            Vector2 temp = new Vector2();

            temp.X = (distance.X / transition.Interval);
            temp.Y = (distance.Y / transition.Interval);

            int x = (int)(defaultVector.X - title.TitleVector.X);
            int y = (int)(defaultVector.Y - title.TitleVector.Y);

            if (((Math.Abs(x) < Math.Abs(temp.X)) || (Math.Abs(y) < Math.Abs(temp.Y))) && transition.State == TransitionState.intro)
            {
                title.TitleVector = defaultVector;
            }
            else
            {
                title.TitleVector += temp;
            }

            transition.update(component);
        }
 private void resetTitle(TitleComponent title)
 {
     if (!float.IsNaN(defaultVector.X) && !float.IsNaN(defaultVector.Y))
     {
         title.TitleVector = defaultVector;
     }
 }
        private void initializeTitle(TitleComponent title)
        {
            if (transition.State == TransitionState.intro)
            {
                defaultVector = title.TitleVector;

                Vector2 temp = new Vector2();

                temp = title.TitleVector + offset;

                title.TitleVector = temp;

                distance = defaultVector - temp;
            }
            else if (transition.State == TransitionState.exit || transition.State == TransitionState.selected)
            {
                defaultVector = title.TitleVector;

                Vector2 temp = new Vector2();

                temp = defaultVector + offset;

                distance = defaultVector - temp;
            }
        }
Exemple #4
0
        private void setAlpha(TitleComponent title)
        {
            Color temp = title.TitleColor;

            temp.A = (byte)alpha;

            title.TitleColor = temp;
        }
Exemple #5
0
        private void resetTitle(TitleComponent title)
        {
            if (defaultAlpha > 0)
            {
                alpha = defaultAlpha;

                setAlpha(title);
            }
        }
Exemple #6
0
        public override void setTransition(IComponent component)
        {
            TitleComponent title = component as TitleComponent;

            initializeTitle(title);
            initialized = true;

            transition.setTransition(component);
        }
Exemple #7
0
        private void initializeTitle(TitleComponent title)
        {
            defaultAlpha = title.TitleColor.A;

            //Set the fade to fade in
            if (transition.State == TransitionState.intro)
            {
                direction = 255;
                alpha     = 0;

                setAlpha(title);
            }
            //Else set the fade to fade out;
            else if (transition.State == TransitionState.exit || transition.State == TransitionState.selected)
            {
                direction = -255;
                alpha     = 255;

                setAlpha(title);
            }
        }
Exemple #8
0
        public override void update(IComponent component)
        {
            TitleComponent title = component as TitleComponent;

            if (!initialized)
            {
                resetTitle(title);
                initializeTitle(title);
                initialized = true;
            }

            int x = 255 - alpha;
            int y = direction / transition.Interval;

            if (x >= y)
            {
                alpha += direction / transition.Interval;
            }

            setAlpha(title);

            transition.update(component);
        }