/// <summary>
        /// Draw all screens. Note that each screen needs to call SpriteBatch.Begin separately, because different matrix transformations can be applied to each screen.
        /// </summary>
        /// <param name="spriteBatch">Sprite batch.</param>
        /// <param name="textureManager">Texture manager.</param>
        public void Draw(SpriteBatch spriteBatch, TextureManager textureManager, FontManager fontManager)
        {
            //We need to draw the last screen last, so we reverse the stack.
            var reverseStack = new Stack<GameScreen> (gameScreens.ToArray ());

            foreach (GameScreen screen in reverseStack)
                screen.Draw (spriteBatch, textureManager, fontManager);
        }
        public override void Draw(SpriteBatch spriteBatch, TextureManager textureManager, FontManager fontManager)
        {
            spriteBatch.Begin ();

            spriteBatch.Draw (textureManager.WhitePixel, new Rectangle (0, 0, MainGame.WindowWidth, MainGame.WindowHeight), Color.Black * 0.5f);

            spriteBatch.DrawString (fontManager.GetFont ("Arial"), "Paused", menu.Position - new Vector2 (0, 50), Color.White);

            menu.Draw (spriteBatch, fontManager);

            spriteBatch.End ();
        }
        public override void Draw(SpriteBatch spriteBatch, TextureManager textureManager, FontManager fontManager)
        {
            //Render world (do transform)
            spriteBatch.Begin (SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, camera.TransformMatrix);

            world.Draw (spriteBatch, textureManager);
            spriteBatch.End ();

            //Render inventory (do not transform)
            spriteBatch.Begin (SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, null);

            world.PlayerInventory.Draw (spriteBatch, textureManager);

            spriteBatch.End ();
        }
Esempio n. 4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch (GraphicsDevice);

            Texture2D whitePix = new Texture2D (graphics.GraphicsDevice, 1, 1);
            whitePix.SetData (new Color[] { Color.White });
            //Load all textures
            textureManager = new TextureManager (Content, whitePix);
            //Load all fonts
            fontManager = new FontManager (Content);
        }
Esempio n. 5
0
 public abstract void Draw(SpriteBatch spriteBatch, TextureManager textureManager, FontManager fontManager);
 public override void Draw(SpriteBatch spriteBatch, TextureManager textureManager, FontManager fontManager)
 {
     throw new NotImplementedException ();
 }
Esempio n. 7
0
 public void Draw(SpriteBatch spriteBatch, FontManager fontManager)
 {
     for (int i = 0; i < menuItems.Count; i++) {
         spriteBatch.DrawString (fontManager.GetFont(fontName), menuItems [i].Text, Position + new Vector2 (0, i * TextHeight), i==selectedMenuItem ? Color.Red : Color.White);
     }
 }