public BaseSprite(float pX, float pY, float pWidth, float pHeight, BaseTextureRegion pTextureRegion, RectangleVertexBuffer pRectangleVertexBuffer)
            : base(pX, pY, pWidth, pHeight, pRectangleVertexBuffer)
        {

            this.mTextureRegion = pTextureRegion;
            this.InitBlendFunction();
        }
        // ===========================================================
        // Constructors
        // ===========================================================

        public BaseTextureRegionBuffer(BaseTextureRegion pBaseTextureRegion, int pDrawType)
        //: base(2 * VERTICES_PER_RECTANGLE, pDrawType)
            : base(2 * RectangleVertexBuffer.VERTICES_PER_RECTANGLE, pDrawType)
        {
            this.mTextureRegion = pBaseTextureRegion;
        }
        // ===========================================================
        // Methods
        // ===========================================================

        //public synchronized void update() {
        public void Update()
        {
            lock (_methodLock)
            {
                BaseTextureRegion textureRegion = this.mTextureRegion;
                Texture           texture       = textureRegion.GetTexture();

                if (texture == null)
                {
                    return;
                }

                int x1 = Float.FloatToRawIntBits(this.GetX1());
                int y1 = Float.FloatToRawIntBits(this.GetY1());
                int x2 = Float.FloatToRawIntBits(this.GetX2());
                int y2 = Float.FloatToRawIntBits(this.GetY2());

                int[] bufferData = this.mBufferData;

                if (this.mFlippedVertical)
                {
                    if (this.mFlippedHorizontal)
                    {
                        bufferData[0] = x2;
                        bufferData[1] = y2;

                        bufferData[2] = x2;
                        bufferData[3] = y1;

                        bufferData[4] = x1;
                        bufferData[5] = y2;

                        bufferData[6] = x1;
                        bufferData[7] = y1;
                    }
                    else
                    {
                        bufferData[0] = x1;
                        bufferData[1] = y2;

                        bufferData[2] = x1;
                        bufferData[3] = y1;

                        bufferData[4] = x2;
                        bufferData[5] = y2;

                        bufferData[6] = x2;
                        bufferData[7] = y1;
                    }
                }
                else
                {
                    if (this.mFlippedHorizontal)
                    {
                        bufferData[0] = x2;
                        bufferData[1] = y1;

                        bufferData[2] = x2;
                        bufferData[3] = y2;

                        bufferData[4] = x1;
                        bufferData[5] = y1;

                        bufferData[6] = x1;
                        bufferData[7] = y2;
                    }
                    else
                    {
                        bufferData[0] = x1;
                        bufferData[1] = y1;

                        bufferData[2] = x1;
                        bufferData[3] = y2;

                        bufferData[4] = x2;
                        bufferData[5] = y1;

                        bufferData[6] = x2;
                        bufferData[7] = y2;
                    }
                }

                FastFloatBuffer buffer = this.GetFloatBuffer();
                buffer.Position(0);
                buffer.Put(bufferData);
                buffer.Position(0);

                base.SetHardwareBufferNeedsUpdate();
            }
        }
        // ===========================================================
        // Constructors
        // ===========================================================

        public BaseSprite(float pX, float pY, float pWidth, float pHeight, BaseTextureRegion pTextureRegion)
            : base(pX, pY, pWidth, pHeight)
        {
            this.mTextureRegion = pTextureRegion;
            this.InitBlendFunction();
        }
        // ===========================================================
        // Constructors
        // ===========================================================

        public BaseTextureRegionBuffer(BaseTextureRegion pBaseTextureRegion, int pDrawType)
            //: base(2 * VERTICES_PER_RECTANGLE, pDrawType)
            : base(2 * RectangleVertexBuffer.VERTICES_PER_RECTANGLE, pDrawType)
        {
            this.mTextureRegion = pBaseTextureRegion;
        }
Beispiel #6
0
 public BaseSprite(float pX, float pY, float pWidth, float pHeight, BaseTextureRegion pTextureRegion, RectangleVertexBuffer pRectangleVertexBuffer)
     : base(pX, pY, pWidth, pHeight, pRectangleVertexBuffer)
 {
     this.mTextureRegion = pTextureRegion;
     this.InitBlendFunction();
 }
Beispiel #7
0
        // ===========================================================
        // Constructors
        // ===========================================================

        public BaseSprite(float pX, float pY, float pWidth, float pHeight, BaseTextureRegion pTextureRegion)
            : base(pX, pY, pWidth, pHeight)
        {
            this.mTextureRegion = pTextureRegion;
            this.InitBlendFunction();
        }