示例#1
0
        CCTex2F TextureCoordFromAlphaPoint(CCPoint alpha)
        {
            CCTex2F ret = new CCTex2F(0.0f, 0.0f);

            if (Sprite != null)
            {
                CCV3F_C4B_T2F_Quad quad = Sprite.Quad;

                CCPoint min = new CCPoint(quad.BottomLeft.TexCoords.U, quad.BottomLeft.TexCoords.V);
                CCPoint max = new CCPoint(quad.TopRight.TexCoords.U, quad.TopRight.TexCoords.V);

                //  Fix bug #1303 so that progress timer handles sprite frame texture rotation
                if (Sprite.IsTextureRectRotated)
                {
                    float tmp = alpha.X;
                    alpha.X = alpha.Y;
                    alpha.Y = tmp;
                }

                ret = new CCTex2F(min.X * (1f - alpha.X) + max.X * alpha.X, min.Y * (1f - alpha.Y) + max.Y * alpha.Y);
            }

            return(ret);
        }
示例#2
0
 public CCV2F_C4F_T2F()
 {
     Vertices = new CCVertex2F();
     Colors = new CCColor4F();
     TexCoords = new CCTex2F();
 }
示例#3
0
 public CCV2F_C4F_T2F()
 {
     Vertices  = new CCVertex2F();
     Colors    = new CCColor4F();
     TexCoords = new CCTex2F();
 }
示例#4
0
        CCTex2F TextureCoordFromAlphaPoint(CCPoint alpha)
        {
            CCTex2F ret = new CCTex2F(0.0f, 0.0f);

            if (Sprite != null) 
            {
                CCV3F_C4B_T2F_Quad quad = Sprite.Quad;

                CCPoint min = new CCPoint (quad.BottomLeft.TexCoords.U, quad.BottomLeft.TexCoords.V);
                CCPoint max = new CCPoint (quad.TopRight.TexCoords.U, quad.TopRight.TexCoords.V);

                //  Fix bug #1303 so that progress timer handles sprite frame texture rotation
                if (Sprite.IsTextureRectRotated) 
                {
                    float tmp = alpha.X;
                    alpha.X = alpha.Y;
                    alpha.Y = tmp;
                }

                ret = new CCTex2F(min.X * (1f - alpha.X) + max.X * alpha.X, min.Y * (1f - alpha.Y) + max.Y * alpha.Y);
            }

            return ret;
        }