Esempio n. 1
0
 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);
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 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();
     }
 }
Esempio n. 4
0
        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);
            }
        }