Esempio n. 1
0
        public override void Draw(IGraphicsAdapter pSystem)
        {
            base.Draw(pSystem);
            var w = Width * _percent;

            pSystem.DrawFillRect(new Rectangle(Position.X, Position.Y + 20, Width, 10), _background);
            pSystem.DrawFillRect(new Rectangle(Position.X + 1, Position.Y + 21, w, 8), _foreground);
        }
Esempio n. 2
0
        public void Draw(IGraphicsAdapter pSystem)
        {
            int   x         = (int)(Evolusim.ActiveCamera.Position.X / BitmapSize);
            int   y         = (int)(Evolusim.ActiveCamera.Position.Y / BitmapSize);
            float numTilesX = Game.Form.Width / (BitmapSize * Game.ActiveCamera.Zoom);
            float numTilesY = Game.Form.Height / (BitmapSize * Game.ActiveCamera.Zoom);

            //Width and height should be the same
            var startPoint = Evolusim.ActiveCamera.ToCameraSpace(new Vector2(x * BitmapSize, y * BitmapSize));

            Vector2 scale    = new Vector2(BitmapSize) * Game.ActiveCamera.Zoom;
            var     currentX = startPoint.X;
            var     currentY = startPoint.Y;
            var     maxX     = Math.Min(x + numTilesX + 3, Size);
            var     maxY     = Math.Min(y + numTilesY + 3, Size);

            for (int i = x; i < maxX; i++)
            {
                for (int j = y; j < maxY; j++)
                {
                    int         tileCount = 0;
                    TerrainType type      = GetTerrainType(i, j);
                    var         brush     = GetBrush(i, j);
                    while (j < maxY && type == GetTerrainType(i, j))
                    {
                        tileCount++;
                        j++;
                    }

                    var height = scale.Y * tileCount;
                    pSystem.DrawFillRect(new Rectangle(currentX, currentY, scale.X + 1, height + 1), brush);
                    currentY += height;
                    j--;
                }
                currentY  = startPoint.Y;
                currentX += scale.X;
            }
        }
Esempio n. 3
0
 public override void Draw(IGraphicsAdapter pSystem)
 {
     pSystem.DrawFillRect(new Rectangle(Position, Width, Height), _background);
     base.Draw(pSystem);
 }