public void Draw(Graphics g, View view, float delta) { int sy = view.GetY() / (Chunk.size * Tile.size) - 2; int my = sy + (int) Math.Ceiling(g.VisibleClipBounds.Height / (Chunk.size * Tile.size)) + 2; int sx = view.GetX() / (Chunk.size * Tile.size) - 2; int mx = sx + (int)Math.Ceiling(g.VisibleClipBounds.Width / (Chunk.size * Tile.size)) + 2; for (int y = sy; y <= my; y++) { for (int x = sx; x <= mx; x++) { Chunk chunk = this.chunkManager.GetChunk(x, y); if (chunk == null) { this.chunkManager.Load(x, y, this.seed); } else { chunk.Draw(g, view, this, delta); } } } for (int y = sy; y <= my; y++) { for (int x = sx; x < mx; x++) { Chunk chunk = this.chunkManager.GetChunk(x, y); if (chunk != null) { chunk.DrawEntities(g, view, this, delta); } } } }
public virtual void Draw(Graphics g, View view, World world, int x, int y, int up, int down, int left, int right) { g.DrawImage(ImageManager.GetImage(this.image), x * Tile.size - view.GetX(), y * Tile.size - view.GetY(), 32, 32); }
protected virtual void Draw(Graphics g, View view, World world, float delta, int image, int offsetX, int offsetY) { g.DrawImage(ImageManager.GetImage(image), this.x * Tile.size - view.GetX() + offsetX, this.y * Tile.size - Tile.size / 4 - view.GetY() + offsetY); }
protected override void Draw(Graphics g, View view, World world, float delta, int image) { g.DrawImage(ImageManager.GetImage(image), this.GetVisualX() - view.GetX(), this.GetVisualY() - Tile.size / 4 - view.GetY()); }