public void Render(Graphics g)
{
//draw the grass
g.DrawRectangle(Pens.DarkGreen, new Rectangle(0, 0, _clientWidth, _clientHeight));
g.FillRectangle(Brushes.DarkGreen, new Rectangle(0, 0, _clientWidth, _clientHeight));
// render regions
if (ParameterManager.Instance.ShowRegions)
{
for (int regionIndex = 0; regionIndex < _regions.Count; regionIndex++)
{
_regions[regionIndex].Render(true, g);
}
}
//render the goals
g.DrawRectangle(Pens.Red, (float)_playingArea.Left, (float)(_clientHeight - ParameterManager.Instance.GoalWidth) / 2.0f, 40.0f, (float)ParameterManager.Instance.GoalWidth);
g.DrawRectangle(Pens.Blue, (float)_playingArea.Right - 40.0f, (float)(_clientHeight - ParameterManager.Instance.GoalWidth) / 2.0f, 40.0f, (float)ParameterManager.Instance.GoalWidth);
//render the pitch markings
GDI.CurrentBrush = Brushes.Transparent;
GDI.CurrentPen = Pens.White;
GDI.DrawCircle(g, _playingArea.VectorCenter, _playingArea.Width * 0.125f);
g.DrawLine(Pens.White, (float)_playingArea.VectorCenter.X, (float)_playingArea.Top, (float)_playingArea.VectorCenter.X, (float)_playingArea.Bottom);
GDI.CurrentBrush = Brushes.White;
GDI.DrawCircle(g, _playingArea.VectorCenter, 2.0f);
_ball.Render(g);
//Render the teams
_redTeam.Render(g);
_blueTeam.Render(g);
//render the walls
for (int wallIndex = 0; wallIndex < _walls.Count; ++wallIndex)
{
_walls[wallIndex].Render(false, g);
}
//show the score
string redGoals = string.Format("Red: {0}", _blueGoal.GoalsScored);
g.DrawString(redGoals, GDI.TextFont, Brushes.Red, new PointF(_clientWidth / 2 + 10, _clientHeight - GDI.TextFont.Height));
string blueGoals = string.Format("Blue: {0}", _redGoal.GoalsScored);
g.DrawString(blueGoals, GDI.TextFont, Brushes.Blue, new PointF(_clientWidth / 2 - g.MeasureString(blueGoals, GDI.TextFont).Width - 10, _clientHeight - GDI.TextFont.Height));
}