Exemple #1
0
        private void pnlGameScreen_Paint(object sender, PaintEventArgs e)
        {
            if (_gameScreen.GridGraphics == null)
            {
                return;
            }

            for (int i = 0; i < _gameScreen.Columns; i++)
            {
                _gameScreen.GridGraphics.DrawLine(_gameScreen.Pen, new Point(i * _gameScreen.UnitSize.Width, 0), new Point(i * _gameScreen.UnitSize.Width, _gameScreen.Screen.Height));
            }
            for (int i = 0; i < _gameScreen.Rows; i++)
            {
                _gameScreen.GridGraphics.DrawLine(_gameScreen.Pen, new Point(0, i * _gameScreen.UnitSize.Height), new Point(_gameScreen.Screen.Width, i * _gameScreen.UnitSize.Height));
            }

            for (int i = 0; i < _tileInfos.GetLength(0); i++)
            {
                for (int j = 0; j < _tileInfos.GetLength(1); j++)
                {
                    Rectangle rectangle = new Rectangle(new Point(_tileInfos[i, j].Position.X * _gameScreen.UnitSize.Width, _tileInfos[i, j].Position.Y * _gameScreen.UnitSize.Height), _gameScreen.UnitSize);
                    DrawAssets.Instance().FillRectangle(_gameScreen.ConstantGraphics, _tileInfos[i, j].Brush, rectangle, 5);
                }
            }

            Draw();
        }
Exemple #2
0
 public override void Draw(Graphics graphics)
 {
     DrawAssets.Instance().DrawTile(graphics, this, _radius);
 }