コード例 #1
0
        public EmissionSettings()
        {
            mInstructions = new InstructionBlueprintList();

            mVelocityRangeType = RangeType.Radial;
            mScaleX            = 1;
            mScaleY            = 1;
            PixelSize          = -1;
            mAlpha             = GraphicalEnumerations.MaxColorComponentValue;

#if FRB_MDX
            mColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.SelectArg1;
#else
            mColorOperation = ColorOperation.Texture;
#endif
            mBlendOperation = BlendOperation.Regular;
        }
コード例 #2
0
        public static bool IsTextureOperationSupportedInFrbXna(Microsoft.DirectX.Direct3D.TextureOperation op)
        {
            switch (op)
            {
            case Microsoft.DirectX.Direct3D.TextureOperation.Add:
            case Microsoft.DirectX.Direct3D.TextureOperation.Modulate:
            case Microsoft.DirectX.Direct3D.TextureOperation.SelectArg1:
            case Microsoft.DirectX.Direct3D.TextureOperation.SelectArg2:
            case Microsoft.DirectX.Direct3D.TextureOperation.Subtract:
            case Microsoft.DirectX.Direct3D.TextureOperation.Modulate2X:
            case Microsoft.DirectX.Direct3D.TextureOperation.Modulate4X:
                return(true);

            default:
                return(false);
                //break;
            }
        }
コード例 #3
0
        public static ColorOperation TranslateTextureOperationToColorOperation(Microsoft.DirectX.Direct3D.TextureOperation op)
        {
            switch (op)
            {
            case Microsoft.DirectX.Direct3D.TextureOperation.Add:
                return(ColorOperation.Add);

            //break;
            case Microsoft.DirectX.Direct3D.TextureOperation.Modulate:
                return(ColorOperation.Modulate);

            //break;
            case Microsoft.DirectX.Direct3D.TextureOperation.SelectArg1:
                return(ColorOperation.Color);

            //break;
            case Microsoft.DirectX.Direct3D.TextureOperation.SelectArg2:
                return(ColorOperation.Texture);

            //break;
            case Microsoft.DirectX.Direct3D.TextureOperation.Subtract:
                return(ColorOperation.Subtract);

            //break;
            case Microsoft.DirectX.Direct3D.TextureOperation.Modulate2X:
                return(ColorOperation.Modulate2X);

            case Microsoft.DirectX.Direct3D.TextureOperation.Modulate4X:
                return(ColorOperation.Modulate4X);

            default:
                throw new System.NotImplementedException(
                          op + " is currently not supported in FlatRedBall MDX");
                //break;
            }
        }
コード例 #4
0
        private void InitialExcludeIncludeMembers()
        {
            ExcludeAllMembers();

            #region Basic Members
            IncludeMember("X", "Basic");
            SetMemberChangeEvent("X", ShowCantEditAbsoluteValuesMessage);
            IncludeMember("Y", "Basic");
            SetMemberChangeEvent("Y", ShowCantEditAbsoluteValuesMessage);
            IncludeMember("Z", "Basic");
            SetMemberChangeEvent("Z", ShowCantEditAbsoluteValuesMessage);

            IncludeMember("Visible", "Basic");
            IncludeMember("CursorSelectable", "Basic");

            IncludeMember("Name", "Basic");

            mOrderingMode = new ComboBox(mCursor);
            mOrderingMode.AddItem("Distance from Camera", OrderingMode.DistanceFromCamera);
            mOrderingMode.AddItem("ZBuffered", OrderingMode.ZBuffered);
            mOrderingMode.ScaleX = 6.5f;
            AddWindow(mOrderingMode, "Basic");
            SetLabelForWindow(mOrderingMode, "OrderingMode");
            mOrderingMode.ItemClick += SetOrderingMode;

            #endregion

            #region Rotation Members

            IncludeMember("RotationX", "Rotation");
            SetMemberChangeEvent("RotationX", ShowCantEditAbsoluteValuesMessage);
            IncludeMember("RotationY", "Rotation");
            SetMemberChangeEvent("RotationY", ShowCantEditAbsoluteValuesMessage);
            IncludeMember("RotationZ", "Rotation");
            SetMemberChangeEvent("RotationZ", ShowCantEditAbsoluteValuesMessage);

            #endregion

            #region Scale Members
            IncludeMember("ScaleX", "Scale");
            IncludeMember("ScaleY", "Scale");

            IncludeMember("PixelSize", "Scale");
            ((UpDown)GetUIElementForMember("PixelSize")).Sensitivity = .01f;
            // Vic says:  Any value for PixelSize above 0 will result in the
            // Sprite having a valid PixelSize.  Values below 0 are ignored.
            // This isn't the best solution, but there's really no reason for
            // a user to ever set a value below -1, so we'll put a cap on that.
            // Eventualy we may want to make this more robust by "hopping" to -1
            // if the user drags the value down below 0, and "hopping" to 0 if the
            // user drags the value up from -1.
            ((UpDown)GetUIElementForMember("PixelSize")).MinValue = -1;

            mSetPixelPerfectScaleButton        = new Button(mCursor);
            mSetPixelPerfectScaleButton.Text   = "Set Pixel\nPerfect Scale";
            mSetPixelPerfectScaleButton.ScaleX = 6;
            mSetPixelPerfectScaleButton.ScaleY = 2f;

            AddWindow(mSetPixelPerfectScaleButton, "Scale");
            mSetPixelPerfectScaleButton.Click += SetPixelPerfectScaleClick;


            #endregion

            #region Animation

            IncludeMember("AnimationChains", "Animation");
            IncludeMember("CurrentChainName", "Animation");
            IncludeMember("Animate", "Animation");
            IncludeMember("AnimationSpeed", "Animation");

            #endregion

            #region Texture Members

            IncludeMember("Texture", "Texture");
            SetMemberChangeEvent("Texture", OnTextureChange);

            IncludeMember("TextureAddressMode", "Texture");

            //mTopTextureCoordinateUpDown = IncludeMember("TopTextureCoordinate", "Texture") as UpDown;
            //mTopTextureCoordinateUpDown.Sensitivity = .01f;

            //mBottomTextureCoordinateUpDown = IncludeMember("BottomTextureCoordinate", "Texture") as UpDown;
            //mBottomTextureCoordinateUpDown.Sensitivity = .01f;

            //mLeftTextureCoordinateUpDown = IncludeMember("LeftTextureCoordinate", "Texture") as UpDown;
            //mLeftTextureCoordinateUpDown.Sensitivity = .01f;

            //mRightTextureCoordinateUpDown = IncludeMember("RightTextureCoordinate", "Texture") as UpDown;
            //mRightTextureCoordinateUpDown.Sensitivity = .01f;
            TextureCoordinatePropertyGridHelper.CreatePixelCoordinateUi(
                this,
                "TopCoordinate",
                "BottomCoordinate",
                "LeftCoordinate",
                "RightCoordinate",
                "Texture",
                out mTopPixel,
                out mLeftPixel,
                out mPixelHeight,
                out mPixelWidth);

            mLeftPixel.ValueChanged   += ChangeLeftPixel;
            mTopPixel.ValueChanged    += ChangeTopPixel;
            mPixelWidth.ValueChanged  += ChangePixelWidth;
            mPixelHeight.ValueChanged += ChangePixelHeight;

            this.AfterUpdateDisplayedProperties += UpdateCustomUI;

            IncludeMember("FlipHorizontal", "Texture");
            IncludeMember("FlipVertical", "Texture");


            mPixelPerfectTextureCoordinates        = new ToggleButton(this.mCursor);
            mPixelPerfectTextureCoordinates.Text   = "Pixel Perfect\nCoordinates";
            mPixelPerfectTextureCoordinates.ScaleX = 5.5f;
            mPixelPerfectTextureCoordinates.ScaleY = 2.1f;

            AddWindow(mPixelPerfectTextureCoordinates, "Texture");

            #endregion

            #region Relative

            IncludeMember("RelativeX", "Relative");
            IncludeMember("RelativeY", "Relative");
            IncludeMember("RelativeZ", "Relative");

            IncludeMember("RelativeRotationX", "Relative");
            IncludeMember("RelativeRotationY", "Relative");
            IncludeMember("RelativeRotationZ", "Relative");

            #endregion

            #region Color

            IncludeMember("ColorOperation", "Color");

#if !FRB_XNA
            ComboBox colorOperationComboBox = GetUIElementForMember("ColorOperation") as ComboBox;

            for (int i = colorOperationComboBox.Count - 1; i > -1; i--)
            {
                Microsoft.DirectX.Direct3D.TextureOperation textureOperation =
                    ((Microsoft.DirectX.Direct3D.TextureOperation)colorOperationComboBox[i].ReferenceObject);

                if (!FlatRedBall.Graphics.GraphicalEnumerations.IsTextureOperationSupportedInFrbXna(
                        textureOperation))
                {
                    colorOperationComboBox.RemoveAt(i);
                }
            }
#endif

            IncludeMember("Red", "Color");
            IncludeMember("Green", "Color");
            IncludeMember("Blue", "Color");

            IncludeMember("BlendOperation", "Blend");
            IncludeMember("Alpha", "Blend");

            #endregion
        }