public MonoGameGameFont(MonoGameFileHandle fntFileHandle, MonoGameFileHandle textureFileHandle)
 {
     _fontName              = fntFileHandle.nameWithoutExtension();
     _spriteFont            = BMFontLoader.LoadXml(fntFileHandle.readString(), ((MonoGameTexture)Mdx.graphics.newTexture(textureFileHandle)).texture2D);
     _sharedFontGlyphLayout = newGlyphLayout();
     _capHeight             = _spriteFont.MeasureString("A").Y;
 }
        public MonoGameOutputStream(MonoGameFileHandle fileHandle, bool append)
        {
            if (!fileHandle.exists() || fileHandle.isDirectory())
            {
                throw new IOException();
            }
            var fileInfo = new FileInfo(fileHandle.pathWithPrefix());

            _stream = append ? fileInfo.Open(FileMode.Append, FileAccess.Write) : fileInfo.Create();
        }
        public MonoGameInputStream(MonoGameFileHandle fileHandle)
        {
            if (!fileHandle.exists() || fileHandle.isDirectory())
            {
                throw new IOException();
            }

            var fileInfo = new FileInfo(fileHandle.fullPath());

            _stream = fileInfo.OpenRead();
        }
Exemple #4
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);
        }
Exemple #5
0
        public MonoGameInputStream(MonoGameFileHandle fileHandle)
        {
            base._init_();
            if (!fileHandle.exists() || fileHandle.isDirectory())
            {
                throw new IOException();
            }

            var fileInfo = new FileInfo(fileHandle.pathWithPrefix());

            _stream = fileInfo.OpenRead();
        }
Exemple #6
0
 public MonoGameGameFont(MonoGameFileHandle ttfFileHandle, int size)
 {
     size++;
     _spriteFont = TtfFontBaker.Bake(ttfFileHandle.readBytesAsByteArray(),
                                     size,
                                     1024,
                                     1024,
                                     new[]
     {
         CharacterRange.BasicLatin,
         CharacterRange.Latin1Supplement,
         CharacterRange.LatinExtendedA,
         CharacterRange.Cyrillic
     }
                                     ).CreateSpriteFont(((MonoGameGraphics)Mdx.graphicsContext_)._graphicsDevice);
     _sharedFontGlyphLayout = newGlyphLayout();
     _capHeight             = _spriteFont.GetGlyphs()['A'].BoundsInTexture.Height;
 }
 public MonoGameGameFont(MonoGameFileHandle ttfFileHandle, int size)
 {
     _fontName   = ttfFileHandle.nameWithoutExtension();
     _spriteFont = TtfFontBaker.Bake(ttfFileHandle.readBytes(),
                                     size,
                                     1024,
                                     1024,
                                     new[]
     {
         CharacterRange.BasicLatin,
         CharacterRange.Latin1Supplement,
         CharacterRange.LatinExtendedA,
         CharacterRange.Cyrillic
     }
                                     ).CreateSpriteFont(((MonoGameGraphics)Mdx.graphicsContext)._graphicsDevice);
     _sharedFontGlyphLayout = newGlyphLayout();
     _capHeight             = _spriteFont.MeasureString("A").Y;
 }
Exemple #8
0
 public MonoGameGameFont(MonoGameFileHandle fileHandle)
 {
     _fileHandle = fileHandle;
 }