Example #1
0
 internal MonoGameGameFontCache(GameFont font)
 {
     _gameFont       = (MonoGameGameFont)font;
     _graphicsDevice = ((MonoGameGraphics)Mdx.graphicsContext)._graphicsDevice;
     _spriteBatch    = new SpriteBatch(_graphicsDevice);
     _gameFontCache  = new MonoGameTexture(new RenderTarget2D(_graphicsDevice, Mdx.graphicsContext.getWindowWidth(), Mdx.graphicsContext.getWindowHeight(), false, SurfaceFormat.Color, _graphicsDevice.PresentationParameters.DepthStencilFormat, 0, RenderTargetUsage.PreserveContents));
     beginSpriteBatch();
 }
        internal MonoGameGameFontCache(GameFont font)
        {
            _gameFont = (MonoGameGameFont)font;

            if (GLOBAL_CACHE == null)
            {
                GLOBAL_CACHE = new MonoGameFontCacheTexture();
            }

            cacheId = GLOBAL_CACHE.allocateId();
        }
Example #3
0
        public static MonoGameGameFont loadBitmapFont(MonoGameFileHandle fntFileHandle)
        {
            var font = new MonoGameGameFont();

            font._spriteFont = BMFontLoader.LoadXml(fntFileHandle.readString(), textureFileName =>
            {
                return(new TextureWithOffset(((MonoGameTexture)Mdx.graphics_.newTexture(fntFileHandle.parent().child(textureFileName))).texture2D));
            });
            font._sharedFontGlyphLayout = font.newGlyphLayout();
            font._capHeight             = font._spriteFont.GetGlyphs()['A'].BoundsInTexture.Height;
            return(font);
        }
 public MonoGameFontGlyphLayout(MonoGameGameFont font)
 {
     _font = font;
 }