Пример #1
0
        /// <summary>
        /// Creates a new sprite object from a given texture.
        /// </summary>
        public SpritePrimitive(PrimitiveRenderer zPrimitiveRenderer, Texture zTexture)
        {
            primitiveRenderer = zPrimitiveRenderer;

            // Units: Texels
            Single sprW = (Single) zTexture.Width;
            Single sprH = (Single) zTexture.Height;

            quad = new Quad();

            Init (zTexture, 0, 0, sprW, sprH );
            SetHotSpot (sprW / 2f, sprH / 2f);
        }
Пример #2
0
        /// <summary>
        /// Creates a new sprite object from part of a given texture.
        /// - zTexX & zTexY represent the an offset in texels that map to the start of the UVs used for the sprite.
        /// - zSprW & zSprH also measured in texels, indicate how much of the texture will be used.
        /// </summary>
        public SpritePrimitive(PrimitiveRenderer zPrimitiveRenderer, Texture zTexture, Single zTexX, Single zTexY, Single zSprW, Single zSprH)
        {
            primitiveRenderer = zPrimitiveRenderer;

            quad = new Quad ();

            Init (zTexture, zTexX, zTexY, zSprW, zSprH);
            SetHotSpot (zSprW / 2f, zSprH / 2f);
        }
Пример #3
0
        /// <summary>
        /// Creates a new sprite object by cloning an existing sprite object.
        /// </summary>
        public SpritePrimitive(PrimitiveRenderer zPrimitiveRenderer, SpritePrimitive zFrom)
        {
            primitiveRenderer = zPrimitiveRenderer;

            quad = new Quad(quad);

            texX = zFrom.texX;
            texY = zFrom.texY;

            sprWidth = zFrom.sprWidth;
            sprHeight = zFrom.sprHeight;

            textureWidth = zFrom.textureWidth;
            textureHeight = zFrom.textureHeight;

            hotX = zFrom.hotX;
            hotY = zFrom.hotY;

            bXFlip = zFrom.bXFlip;
            bYFlip = zFrom.bYFlip;
            bHSFlip = zFrom.bHSFlip;
        }