Exemplo n.º 1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            string path = System.IO.Path.Combine(Parent.Content.RootDirectory, "Fonts/octin-stencil-100.fnt");
            fontTexture = Parent.Content.Load<Texture2D>("Fonts/octin-stencil-100_0.png");
            fontFile = FontLoader.Load(path);
            fontRenderer = new FontRenderer(fontFile, fontTexture);
        }
Exemplo n.º 2
0
        public FontRenderer(FontFile fontFile, Texture2D fontTexture)
        {
            _fontFile = fontFile;
            _texture = fontTexture;
            _characterMap = new Dictionary<char, FontChar>();

            foreach (var fontCharacter in _fontFile.Chars)
            {
                char c = (char)fontCharacter.ID;
                _characterMap.Add(c, fontCharacter);
            }
        }
Exemplo n.º 3
0
        protected override void LoadContent()
        {
            base.LoadContent();

            string path = System.IO.Path.Combine(Parent.Content.RootDirectory, "Fonts/octin-stencil-60.fnt");
            ScoreFontTexture = Parent.Content.Load<Texture2D>("Fonts/octin-stencil-60_0.png");
            fontFile = FontLoader.Load(path);
            fontRenderer = new FontRenderer(fontFile, ScoreFontTexture);

            HitPointBar.LoadContent();
        }
Exemplo n.º 4
0
        protected override void LoadContent()
        {
            base.LoadContent();

            string path = System.IO.Path.Combine(
                Parent.Content.RootDirectory, 
                "Fonts/octin-stencil-gameover.fnt");

            fontTexture = Parent.Content.Load<Texture2D>("Fonts/octin-stencil-gameover_0.png");
            fontFile = FontLoader.Load(path);
            fontRenderer = new FontRenderer(fontFile, fontTexture);

            Random rand = new Random(DateTime.Now.Millisecond);

            for (int i = 0; i < ExplosionsAmount; i++)
            {
                Vector2 pos = new Vector2(rand.Next(MaxPositions.X),
                                          rand.Next(MaxPositions.Y));

                Utils.AnimatedTexture anim = 
                    new Utils.AnimatedTexture(
                        Vector2.Zero, 
                        0f, 
                        1f,
                        0f, 
                        new Point(192, 192));

                anim.Load(Parent.Content, "explosion.png", 8, 10);
                anim.Pause();
                KeyValuePair<Vector2, Utils.AnimatedTexture> pair = 
                    new KeyValuePair<Vector2, Utils.AnimatedTexture>(pos, anim);

                Explosions.Add(pair);

                Point res = new Point(Parent.GraphicsDevice.Viewport.Width,
                                      Parent.GraphicsDevice.Viewport.Height);

                HomingScreen = Parent.Content.Load<Texture2D>("HomingTexture.png");
            }
        }