コード例 #1
0
        public static SpriteAnimationCollection readFrom(String fileName, SpriteSheetCollection spriteSheets)
        {
            if (fileName == null || spriteSheets == null || !File.Exists(fileName))
            {
                return(null);
            }

            SpriteAnimation           animation;
            SpriteAnimationCollection animations = new SpriteAnimationCollection();

            StreamReader input = null;

            try {
                input = File.OpenText(fileName);

                do
                {
                    animation = SpriteAnimation.parseFrom(input, spriteSheets);
                    animations.addAnimation(animation);
                } while(animation != null);

                input.Close();
            }
            catch (Exception) {
                return(null);
            }

            return(animations);
        }
コード例 #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // parse and load all sprite sheets
            spriteSheets = SpriteSheetCollection.parseFrom(Content.RootDirectory + "/" + settings.spriteSheetFileName, Content);

            // parse and load all sprite animations
            animations = SpriteAnimationCollection.readFrom(Content.RootDirectory + "/" + settings.animationsFileName, spriteSheets);


            // load game content
            menu.loadContent(Content);

            console.loadContent(Content);
        }