DrawCircle() public static méthode

public static DrawCircle ( Graphics g, Vector2D location, double radius ) : void
g System.Drawing.Graphics
location Vector2D
radius double
Résultat void
        //--------------------------- Render -------------------------------------
        //
        //------------------------------------------------------------------------
        public override void Render(Graphics g)
        {
            List <Vector2D> transformed = Transformations.WorldTransform(_vecPlayerVB,
                                                                         Position,
                                                                         _lookAt,
                                                                         _lookAt.Perp,
                                                                         Scale);


            GDI.CurrentPen = Team.Color == SoccerTeam.SoccerTeamColor.Blue ? bluePen : redPen;
            GDI.DrawPolygon(g, transformed);

            //draw the head
            GDI.CurrentBrush = new SolidBrush(Color.FromArgb(133, 90, 0));
            GDI.DrawCircle(g, Position, 6.0f);

            //draw the ID
            if (ParameterManager.Instance.ShowIDs)
            {
                g.DrawString(ObjectId.ToString(), GDI.TextFont, textBrush, new PointF((float)Position.X - 20.0f, (float)Position.Y - GDI.TextFont.Height));
            }

            //draw the state
            if (ParameterManager.Instance.ShowStates)
            {
                Brush textBrush = new SolidBrush(Color.FromArgb(0, 170, 0));
                g.DrawString(_stateMachine.CurrentState.ToString(), GDI.TextFont, textBrush, new PointF((float)Position.X, (float)Position.Y - GDI.TextFont.Height));
            }
        }
Exemple #2
0
        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));
        }
        //--------------------------- Render -------------------------------------
        //
        //------------------------------------------------------------------------
        public override void Render(Graphics g)
        {
            //set appropriate team color
            GDI.CurrentPen = (Team.Color == SoccerTeam.SoccerTeamColor.Blue) ? Pens.Blue : Pens.Red;

            // draw the body, translated to it's local coordinate space
            List <Vector2D> vectors = Transformations.WorldTransform(_vecPlayerVB, Position, Heading, Side, Scale);

            GDI.DrawPolygon(g, vectors);

            // draw his head
            GDI.CurrentBrush = new SolidBrush(Color.FromArgb(133, 90, 0));
            if (ParameterManager.Instance.ShowHighlightIfThreatened && (Team.ControllingPlayer == this) && IsThreatened())
            {
                GDI.CurrentBrush = Brushes.Yellow;
            }
            GDI.DrawCircle(g, Position, 6.0f);

            //render the state
            if (ParameterManager.Instance.ShowStates)
            {
                Brush stateBrush = new SolidBrush(Color.FromArgb(0, 170, 0));
                g.DrawString(_stateMachine.CurrentState.ToString(), GDI.TextFont, stateBrush, new PointF((float)Position.X, (float)Position.Y - GDI.TextFont.Height));
            }

            //show IDs
            if (ParameterManager.Instance.ShowIDs)
            {
                g.DrawString(ObjectId.ToString(), GDI.TextFont, textBrush, new PointF((float)Position.X - 20.0f, (float)Position.Y - GDI.TextFont.Height));
            }

            if (ParameterManager.Instance.ShowViewTargets)
            {
                g.FillEllipse(textBrush, new RectangleF((float)SteeringBehaviors.Target.X, (float)SteeringBehaviors.Target.Y, 3.0f, 3.0f));
                g.DrawString(ObjectId.ToString(), GDI.TextFont, Brushes.Red, new PointF((float)SteeringBehaviors.Target.X, (float)SteeringBehaviors.Target.Y));
            }
        }