public override void Draw(SpriteBatch spriteBatch, ParentNode parentNode) { // loop through all layers to draw them foreach (TileLayer layer in Layers) { layer.Draw(spriteBatch, parentNode); } }
public override void Draw(SpriteBatch spriteBatch, ParentNode parentNode) { foreach (Tile tile in Tiles) { Matrix globalTransform = tile.GetLocalTransform() * GameManager.currentDrawCamera.GetTransformMatrix(); Vector2 position, scale; Node.decomposeMatrix(ref globalTransform, out position, out scale); spriteBatch.Draw(tile.tileset.Graphic, new Vector2(position.X * ScrollFactor.X, position.Y * ScrollFactor.Y), tile.sourceRect, Color.White, 0, Vector2.Zero, scale, new SpriteEffects(), 1); } }
protected override void DrawCall(SpriteBatch spriteBatch, ParentNode parentNode) { int amountX = this.TiledWidth / this.Texture.Width; int amountY = this.TiledHeight / this.Texture.Height; ParentNode newParentNode = new ParentNode(); newParentNode.Alpha = this.Alpha; for (int x = 0; x < amountX; x++) { for (int y = 0; y < amountY; y++) { newParentNode.Position = parentNode.Position + new Vector2(x * this.Texture.Width * this.Scale.X, y * this.Texture.Height * this.Scale.Y); base.DrawCall(spriteBatch, newParentNode); } } }
public virtual void Draw(SpriteBatch spriteBatch, ParentNode parentNode) { if (!Visable || !Active) return; parentNode.Position += this.Position; parentNode.Alpha = Math.Min(this.Alpha, parentNode.Alpha); int childrenCount = this.Children.Count; for (int i = 0; i < childrenCount; i++) this.Children[i].Draw(spriteBatch, parentNode); }
public void Draw(SpriteBatch spriteBatch) { ParentNode parentNode = new ParentNode(); parentNode.Position = this.Position; parentNode.Alpha = this.Alpha; this.Draw(spriteBatch, parentNode); }
protected virtual void DrawCall(SpriteBatch spriteBatch, ParentNode parentNode) { if (this.Texture == null) return; Sprite.DrawPosition.X = parentNode.Position.X * this.ScrollFactor.X; Sprite.DrawPosition.Y = parentNode.Position.Y * this.ScrollFactor.Y; if (Animating) spriteBatch.Draw(Texture, Sprite.DrawPosition, new Rectangle(CurrentAnimation.frames[CurrentFrame] * Width, 0, Width, Height), this.Color * parentNode.Alpha, this.Rotation, this.Origin, this.Scale, this.SpriteEffects, Node.GetDrawDepth(this.GetParentDepth())); else spriteBatch.Draw(Texture, Sprite.DrawPosition, this.SourceRectangle, this.Color * parentNode.Alpha, this.Rotation, this.Origin, this.Scale, this.SpriteEffects, Node.GetDrawDepth(this.GetParentDepth())); }
public override void Draw(SpriteBatch spriteBatch, ParentNode parentNode) { parentNode.Position += this.Position; parentNode.Alpha = Math.Min(this.Alpha, parentNode.Alpha); if (!Visable || !GameManager.currentDrawCamera.BoundingBox.Intersects(this.GetBoundingBox(parentNode.Position))) return; this.SpriteEffects = SpriteEffects.None; if(Facing == Facing.Left) this.SpriteEffects = SpriteEffects.FlipHorizontally; this.DrawCall(spriteBatch, parentNode); base.Draw(spriteBatch, parentNode); }
protected override void DrawCall(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, ParentNode parentNode) { spriteBatch.DrawString(GameManager.fontDefault, "152", this.Position, this.Color * this.Alpha, this.Rotation, this.Origin, this.Scale, this.SpriteEffects, this.GetParentDepth()); }
protected override void DrawCall(SpriteBatch spriteBatch, ParentNode parentNode) { base.DrawCall(spriteBatch, parentNode); this.DrawBorders(spriteBatch, parentNode.Position); }