コード例 #1
0
        public Vector2 Render(GameTime gameTime, string strSheetName, string strAnimationName, Vector2 vPos, Vector2 vSize, AnimationState state, float fRotation, float fOverX, float fOverY)
        {
            AnimationSheet pSheet = GetSheet(strSheetName);

            Debug.Assert(pSheet != null);
            if (pSheet == null)
            {
                return(new Vector2(0, 0));
            }

            return(pSheet.Render(gameTime, strAnimationName, vPos, vSize, state, fRotation, fOverX, fOverY));
        }
コード例 #2
0
ファイル: ContentRegister.cs プロジェクト: codecat/mrag2
        /// <summary>
        /// Get an animation sheet from cache or from disk.
        /// Note: You will need seperate AnimationSheetState objects to render these, you can't use the internal states.
        /// </summary>
        /// <param name="strFilename">The content filename to the png.</param>
        /// <returns>The animation sheet.</returns>
        public static AnimationSheet AnimationSheet(string strFilename)
        {
            strFilename = SanitizeInput(strFilename);
            string strDicName = DicName(strFilename);

            if (dicAnimationSheets.ContainsKey(strDicName))
            {
                return(dicAnimationSheets[strDicName]);
            }
            else
            {
                AnimationSheet sheet = new AnimationSheet(Mrag.SpriteBatch, "Content/" + strFilename);
                dicAnimationSheets[strDicName] = sheet;
                return(sheet);
            }
        }
コード例 #3
0
        public Vector2 GetSize(string strSheetName, string strAnimationName)
        {
            AnimationSheet pSheet = GetSheet(strSheetName);

            Debug.Assert(pSheet != null);
            if (pSheet == null)
            {
                return(new Vector2(0, 0));
            }

            Animation pAnim = pSheet.GetAnimation(strAnimationName);

            Debug.Assert(pAnim != null);
            if (pAnim == null)
            {
                return(new Vector2(0, 0));
            }

            return(pAnim.ani_vSize);
        }
コード例 #4
0
        public void Load(CustomSpriteBatch spriteBatch, string strFilename)
        {
            Unload();

            XmlFile xmlFile = new XmlFile(strFilename.Replace(".png", ".xml"));
            XmlTag  pSheets = xmlFile.Root.FindTagByName("sheets");

            Debug.Assert(pSheets != null);
            if (pSheets == null)
            {
                return;
            }

            XmlTag[] sheets = pSheets.FindTagsByName("sheet");

            for (int i = 0; i < sheets.Length; i++)
            {
                AnimationSheet sheet = new AnimationSheet();
                sheet.Load(spriteBatch, sheets[i], strFilename);
                asc_saSheets.Add(sheet);
            }
        }