public StartMenu(ContentManager Content) { GameStarted = false; GameOver.AlreadySorted = false; fontFilePath = Path.Combine(Content.RootDirectory, "Fonts/Font1.fnt"); fontFile = FontLoader.Load(fontFilePath); fontTexture = Content.Load <Texture2D>("Fonts/Font1_0.png"); FontRenderer = new FontRenderer(fontFile, fontTexture); }
public static FontFile Load(String filename) { XmlSerializer deserializer = new XmlSerializer(typeof(FontFile)); TextReader textReader = new StreamReader(filename); FontFile file = (FontFile)deserializer.Deserialize(textReader); textReader.Close(); return(file); }
public GameOver(ContentManager Content) { this.fontFilePath = Path.Combine(Content.RootDirectory, "Fonts/Font1.fnt"); using (var stream = TitleContainer.OpenStream(fontFilePath)) { fontFile = FontLoader.Load(fontFilePath); fontTexture = Content.Load <Texture2D>("Fonts/Font1_0.png"); FontRenderer = new FontRenderer(fontFile, fontTexture); stream.Close(); } }
public FontRenderer(FontFile fontFile, Texture2D fontTexture) { FFile = fontFile; FTexture = fontTexture; CharMap = new Dictionary <char, FontChar>(); foreach (var fontCharacter in FFile.Chars) { char c = (char)fontCharacter.ID; CharMap.Add(c, fontCharacter); } }