Exemplo n.º 1
0
        public static AsTexture fromTexture(AsTexture texture, AsRectangle region, AsRectangle frame)
        {
            AsTexture subTexture = new AsSubTexture(texture, region);

            subTexture.mFrame = frame;
            return(subTexture);
        }
        private void setClipping(AsRectangle _value)
        {
            mClipping     = _value;
            mRootClipping = _value.clone();
            AsSubTexture parentTexture = mParent as AsSubTexture;

            while (parentTexture != null)
            {
                AsRectangle parentClipping = parentTexture.mClipping;
                mRootClipping.x      = parentClipping.x + mRootClipping.x * parentClipping.width;
                mRootClipping.y      = parentClipping.y + mRootClipping.y * parentClipping.height;
                mRootClipping.width  = mRootClipping.width * parentClipping.width;
                mRootClipping.height = mRootClipping.height * parentClipping.height;
                parentTexture        = parentTexture.mParent as AsSubTexture;
            }
        }
Exemplo n.º 3
0
        protected virtual void parseAtlasXml(AsXML atlasXml)
        {
            float        scale          = mAtlasTexture.getScale();
            AsSubTexture __subTextures_ = atlasXml.SubTexture;

            if (__subTextures_ != null)
            {
                foreach (AsXML subTexture in __subTextures_)
                {
                    String      name        = subTexture.attribute("name");
                    float       x           = AsGlobal.parseFloat(subTexture.attribute("x")) / scale;
                    float       y           = AsGlobal.parseFloat(subTexture.attribute("y")) / scale;
                    float       width       = AsGlobal.parseFloat(subTexture.attribute("width")) / scale;
                    float       height      = AsGlobal.parseFloat(subTexture.attribute("height")) / scale;
                    float       frameX      = AsGlobal.parseFloat(subTexture.attribute("frameX")) / scale;
                    float       frameY      = AsGlobal.parseFloat(subTexture.attribute("frameY")) / scale;
                    float       frameWidth  = AsGlobal.parseFloat(subTexture.attribute("frameWidth")) / scale;
                    float       frameHeight = AsGlobal.parseFloat(subTexture.attribute("frameHeight")) / scale;
                    AsRectangle region      = new AsRectangle(x, y, width, height);
                    AsRectangle frame       = frameWidth > 0 && frameHeight > 0 ? new AsRectangle(frameX, frameY, frameWidth, frameHeight) : null;
                    addRegion(name, region, frame);
                }
            }
        }
Exemplo n.º 4
0
 public static AsTexture fromTexture(AsTexture texture, AsRectangle region, AsRectangle frame)
 {
     AsTexture subTexture = new AsSubTexture(texture, region);
     subTexture.mFrame = frame;
     return subTexture;
 }