Esempio n. 1
0
        public RenderBreak(int itemNumber, Texture2D texture,
                           ColorOperation colorOperation,
                           BlendOperation blendOperation, TextureAddressMode textureAddressMode)
        {
#if DEBUG
            ObjectCausingBreak = null;
#endif
            LayerName = Renderer.CurrentLayerName;


            PrimitiveType = PrimitiveType.TriangleList;
            ItemNumber    = itemNumber;

            if (texture != null && texture.IsDisposed)
            {
                throw new ObjectDisposedException("Cannot create render break with disposed Texture2D");
            }

            mTexture               = texture;
            ColorOperation         = colorOperation;
            BlendOperation         = blendOperation;
            TextureAddressMode     = textureAddressMode;
            TextureFilter          = FlatRedBallServices.GraphicsOptions.TextureFilter;
            _originalTextureFilter = TextureFilter.Linear;

#if MONOGAME
            Red   = 0;
            Green = 0;
            Blue  = 0;
#endif
        }
Esempio n. 2
0
        public RenderBreak(int itemNumber, Text text, int textureIndex)
        {
#if DEBUG
            ObjectCausingBreak = text;
#endif
            LayerName = Renderer.CurrentLayerName;


#if WINDOWS_PHONE || MONOGAME
            if (text.ColorOperation != Graphics.ColorOperation.Texture)
            {
                Red   = text.Red;
                Green = text.Green;
                Blue  = text.Blue;
            }
            else
            {
                Red   = 1;
                Green = 1;
                Blue  = 1;
            }
#endif

            ItemNumber = itemNumber;

            PrimitiveType          = PrimitiveType.TriangleList;
            TextureFilter          = FlatRedBallServices.GraphicsOptions.TextureFilter;
            _originalTextureFilter = TextureFilter.Linear;

            if (text != null)
            {
                if (text.Font.Texture != null && text.Font.Texture.IsDisposed)
                {
                    throw new ObjectDisposedException("Cannot create render break with disposed Texture2D");
                }

                mTexture = text.Font.Textures[textureIndex];

                ColorOperation     = text.ColorOperation;
                BlendOperation     = text.BlendOperation;
                TextureAddressMode = TextureAddressMode.Clamp;
            }
            else
            {
                mTexture           = null;
                ColorOperation     = ColorOperation.None;
                BlendOperation     = BlendOperation.Regular;
                TextureAddressMode = TextureAddressMode.Clamp;
            }
        }
Esempio n. 3
0
        public RenderBreak(int itemNumber, Sprite sprite)
        {
#if DEBUG
            ObjectCausingBreak = sprite;
#endif
            LayerName              = Renderer.CurrentLayerName;
            ItemNumber             = itemNumber;
            PrimitiveType          = PrimitiveType.TriangleList;
            _originalTextureFilter = TextureFilter.Linear;

            if (sprite != null)
            {
                if (sprite.Texture != null && sprite.Texture.IsDisposed)
                {
                    throw new ObjectDisposedException("The Sprite with the name \"" + sprite.Name +
                                                      "\" references a disposed texture of the name " + sprite.Texture.Name +
                                                      ".  If you're using Screens you may have forgotten to remove a Sprite that was " +
                                                      "added in the Screen.");
                }

                mTexture = sprite.Texture;

                ColorOperation = sprite.ColorOperation;
                BlendOperation = sprite.BlendOperation;
                TextureFilter  = sprite.TextureFilter.HasValue ? sprite.TextureFilter.Value : FlatRedBallServices.GraphicsOptions.TextureFilter;

#if FRB_XNA
                if (sprite.Texture == null)
                {
                    // requirement for reach profile - this shouldn't impact anything
                    TextureAddressMode = Microsoft.Xna.Framework.Graphics.TextureAddressMode.Clamp;
                }
                else
#endif
                {
                    TextureAddressMode = sprite.TextureAddressMode;
                }


#if WINDOWS_PHONE || MONOGAME
                Red   = sprite.Red;
                Green = sprite.Green;
                Blue  = sprite.Blue;
#endif
            }
            else
            {
#if WINDOWS_PHONE || MONOGAME
                Red   = 0;
                Green = 0;
                Blue  = 0;
#endif

                mTexture = null;
#if FRB_MDX
                ColorOperation = TextureOperation.SelectArg1;
#else
                ColorOperation = ColorOperation.None;
#endif
                BlendOperation     = BlendOperation.Regular;
                TextureAddressMode = TextureAddressMode.Clamp;
                TextureFilter      = FlatRedBallServices.GraphicsOptions.TextureFilter;
            }
        }