Ejemplo 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);
 }
Ejemplo 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);
        }
Ejemplo 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();
     }
 }
Ejemplo 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);
            }
        }