コード例 #1
0
ファイル: Base.cs プロジェクト: swiercc/SpacebarClicker
        // CalculateColor
        private void CalculateColor()
        {
            float oldAlphaFinal     = AlphaFinal;
            float oldIntensityFinal = IntensityFinal;

            AlphaFinal     = Alpha;
            IntensityFinal = Intensity;

            bool doAlpha     = IsFlagSet(E_WidgetFlag.InheritAlpha);
            bool doIntensity = IsFlagSet(E_WidgetFlag.InheritIntensity);

            for (WidgetBase p = ParentWidget; p != null; p = p.ParentWidget)
            {
                if (doAlpha)
                {
                    AlphaFinal *= p.Alpha;
                }

                if (doIntensity)
                {
                    if (p.Intensity > 1.0f)
                    {
                        IntensityFinal += (p.Intensity - 1.0f);
                    }
                    else
                    {
                        IntensityFinal *= p.Intensity;
                    }
                }

                doAlpha     &= p.IsFlagSet(E_WidgetFlag.InheritAlpha);
                doIntensity &= p.IsFlagSet(E_WidgetFlag.InheritIntensity);

                if (!doAlpha && !doIntensity)
                {
                    break;
                }
            }

            if ((AlphaFinal != oldAlphaFinal) || (IntensityFinal != oldIntensityFinal) || IsFlagSet(E_WidgetFlag.DirtyColor))
            {
                ColorFinal.Set(ref ColorBase, AlphaFinal, IntensityFinal);

                if (RenderState.BlendState == E_BlendState.AlphaBlend)
                {
                    ColorFinal.ToPremultiplied();
                }

                FlagClear(E_WidgetFlag.DirtyColor);
            }
        }
コード例 #2
0
        // AutoTransform
        public AutoTransform(WidgetBase widget)
        {
            Widget = widget;

            OldIndex  = _UI.Sprite.AutoTransformIndex;
            OldOffset = _UI.Sprite.AutoTransformOffset;

            int     newIndex  = 0;
            Vector3 newOffset = new Vector3();

            if (Widget.IsFlagSet(E_WidgetFlag.UseMatrix))
            {
                newIndex  = _UI.Sprite.StorePostMatrix(ref Widget.TransformMatrix);
                newOffset = -Widget.Position;
            }

            _UI.Sprite.SetAutoTransform(newIndex, ref newOffset);
        }
コード例 #3
0
	// AutoTransform
	public AutoTransform( WidgetBase widget )
	{
		Widget = widget;

		OldIndex = _UI.Sprite.AutoTransformIndex;
		OldOffset = _UI.Sprite.AutoTransformOffset;

		int newIndex = 0;
		Vector3 newOffset = new Vector3();

		if ( Widget.IsFlagSet( E_WidgetFlag.UseMatrix ) )
		{
			newIndex = _UI.Sprite.StorePostMatrix( ref Widget.TransformMatrix );
			newOffset = -Widget.Position;
		}

		_UI.Sprite.SetAutoTransform( newIndex, ref newOffset );
	}