public void Draw(SpriteBatch spriteBatch, TextureManager textureManager) { for (int i = 0; i < Columns; i++) for (int j = 0; j < Rows; j++) { if (selectedSlot != slots[i, j]) { int disp = SlotSpacing + Item.SpriteWidth; int x = (int)screenPosition.X + disp * i; int y = (int)screenPosition.Y + disp * j; Rectangle r = new Rectangle (x, y, Item.SpriteWidth, Item.SpriteWidth); spriteBatch.Draw (textureManager.WhitePixel, r, Color.White * 0.5f); if (slots [i, j].HasItem) spriteBatch.Draw (textureManager.GetTexture ("items"), null, r, slots [i, j].Item.getTextureSourceRect (), null, 0, null, null, SpriteEffects.None, 0); } else { int disp = SlotSpacing + Item.SpriteWidth; int x = (int)screenPosition.X + disp * i; int y = (int)screenPosition.Y + disp * j; Rectangle r = new Rectangle (x, y, Item.SpriteWidth, Item.SpriteWidth); spriteBatch.Draw (textureManager.WhitePixel, r, Color.Red * 0.5f); if (slots[i,j].HasItem) spriteBatch.Draw (textureManager.GetTexture ("items"), null, r, slots [i, j].Item.getTextureSourceRect (), null, 0, null, null, SpriteEffects.None, 0); } } }
/// <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); }
/// <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); }
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 (); }
public void Draw(SpriteBatch spriteBatch, TextureManager textureManager) { }
public override void Draw(SpriteBatch spriteBatch, TextureManager textureManager) { //Do all the drawing for the player here. Texture2D t = textureManager.GetTexture ("circle"); spriteBatch.Draw (t, CollisionBox, Color.White); }
public abstract void Draw(SpriteBatch spriteBatch, TextureManager textureManager, FontManager fontManager);
public override void Draw(SpriteBatch spriteBatch, TextureManager textureManager, FontManager fontManager) { throw new NotImplementedException (); }
public void Draw(SpriteBatch spriteBatch, TextureManager textureManager) { foreach (WorldLayer layer in layers) { for (int i = 0; i < Width; i++) { for (int j = 0; j < Height; j++) { if (layer.Tiles[i,j].Type!=TileType.Air) spriteBatch.Draw (textureManager.GetTexture ("tiles"), null, new Rectangle (i * TileWidth, j * TileWidth, TileWidth, TileWidth), getTileSourceRect (layer.Tiles [i, j]), null, layer.Tiles[i,j].Rotation, null, Color.White, SpriteEffects.None, 0); } } } player.Draw (spriteBatch, textureManager); }