Beispiel #1
0
        public void Draw()
        {
            if ((_isShiftPressed || _isCtrlPressed) && _myClipboard.Count > 0)
            {
                double opacity = GetPastingBallsOpacity();

                if (opacity > 0d)
                {
                    #region Draw Pasting Balls

                    Ball tempBall = null;

                    foreach (BallBlip blip in _myClipboard)
                    {
                        // Clone the ball
                        tempBall = blip.Ball.CloneBall();

                        // Figure out where to place the pasted object
                        MyVector newPosition = tempBall.Position - _clipboardPositionCenter;
                        newPosition.Add(_curMousePoint);
                        tempBall.Position.StoreNewValues(newPosition);

                        // Draw it
                        if (tempBall is SolidBall)
                        {
                            _renderer.DrawSolidBall((SolidBall)tempBall, ObjectRenderer.DrawMode.Building, blip.CollisionStyle, false, opacity);
                        }
                        else
                        {
                            _renderer.DrawBall(tempBall, ObjectRenderer.DrawMode.Building, blip.CollisionStyle, false, opacity);
                        }
                    }

                    #endregion
                }
            }

            if (_isMouseDown == MouseButtonDown.Left && _mode == SelectionMode.Rectangle)
            {
                #region Draw Rectangle

                MyVector topLeft, bottomRight;
                GetProperCorners(out topLeft, out bottomRight, _mouseDownPoint, _curMousePoint);

                _picturebox.DrawRectangle(Color.Silver, DashStyle.Dash, 1d, topLeft, bottomRight);

                #endregion
            }
            else if (_isMouseDown == MouseButtonDown.Right)
            {
                // Draw Velocity
                _picturebox.DrawLine(Color.Chartreuse, 12d, _mouseDownPoint, _curMousePoint);
            }

            //TODO:  draw the angular velocity
        }