예제 #1
0
파일: SpriteInfo.cs 프로젝트: microm/eplib
        internal ImgData AddRegion(System.Drawing.Point start, System.Drawing.Point end)
        {
            ImgData img = new ImgData();

            img.Region = new Tool.TSystem.Primitive.Rect(start.X, start.Y, end.X, end.Y);
            img.Pivot = new TPoint(img.Region.Width / 2, img.Region.Height / 2);

            ImgList.Add(img);

            return img;
        }
예제 #2
0
        public void UpdateSprite()
        {
            if (m_selectImgData == m_main.SelectSprite.ImgList[m_index])
                return;

            m_selectImgData = m_main.SelectSprite.ImgList[m_index];

            Invalidate();
        }
예제 #3
0
파일: SpriteInfo.cs 프로젝트: microm/eplib
        public void Read(XmlNode spriteNode)
        {
            m_name = GenericXmlReader.ReadStringAttribute(spriteNode, "name");
            m_path = GenericXmlReader.ReadStringAttribute(spriteNode, "path");
            m_hasColorKey = GenericXmlReader.IsExistAttribute( spriteNode , "colorKey" );
            if ( m_hasColorKey )
            {
                m_colorKey = GenericXmlReader.ReadColorAttribute(spriteNode, "colorKey");
            }
            if (GenericXmlReader.IsExistAttribute(spriteNode, "parts"))
            {
                m_isParts = GenericXmlReader.ReadBoolAttribute(spriteNode, "parts");
            }
            if (GenericXmlReader.IsExistAttribute(spriteNode, "speed"))
            {
                m_speed = GenericXmlReader.ReadFloatAttribute(spriteNode, "speed");
                m_isCircle = GenericXmlReader.ReadBoolAttribute(spriteNode, "circle");
            }
            else
            {
                m_speed = 0;
                m_isCircle = false;
            }

            XmlNodeList imgNode = spriteNode.SelectNodes("img");
            foreach (XmlNode node in imgNode)
            {
                ImgData img = new ImgData();

                img.Pivot = GenericXmlReader.ReadPointAttribute(node, "pivot");
                img.Region = GenericXmlReader.ReadRectAttribute(node, "region");
                m_imgList.Add(img);
            }
        }