public BitmapFont(BitmapFontFile file, Bitmap bitmap) { var regions = GenerateRegions(file); this.regions = regions.ToDictionary(r => r.Character); Texture = new Texture(bitmap); LineHeight = file.Common.LineHeight; TextureSize = new Vector2(bitmap.Width, bitmap.Height); }
private List<BitmapFontRegion> GenerateRegions(BitmapFontFile file) { var regions = new List<BitmapFontRegion>(); foreach (var character in file.Chars) { BitmapFontRegion region = new BitmapFontRegion() { Character = (char)character.ID, Rect = new Rectangle(character.X, character.Y, character.Width, character.Height), XOffset = character.XOffset, YOffset = character.YOffset, XAdvance = character.XAdvance }; regions.Add(region); } return regions; }