예제 #1
0
 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);
             }
         }
     }
 }
예제 #2
0
파일: Tile.cs 프로젝트: Quaade/SurvivalGame
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
파일: Unit.cs 프로젝트: Quaade/SurvivalGame
 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());
 }