コード例 #1
0
ファイル: Game1.cs プロジェクト: johnfredcee/SpriteFontPlus
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            string fontData;

            using (var stream = TitleContainer.OpenStream("Fonts/test.fnt"))
            {
                using (var reader = new StreamReader(stream))
                {
                    fontData = reader.ReadToEnd();
                }
            }

            _font = BMFontLoader.Load(fontData, name => TitleContainer.OpenStream("Fonts/" + name), GraphicsDevice);

            GC.Collect();
        }
コード例 #2
0
        public SpriteFont Load(AssetLoaderContext context, string assetName)
        {
            var fontData = context.Load <string>(assetName);

            return(BMFontLoader.Load(fontData, name => TextureGetter(context, name)));
        }