示例#1
0
        public void SetPointers(LargeMapViewer2D picturebox, ShipController shipController)
        {
            _picturebox = picturebox;
            _shipController = shipController;

            // Apply Settings
            txtMinSize_TextChanged(this, new EventArgs());
            txtMaxSize_TextChanged(this, new EventArgs());
            cboType_SelectedIndexChanged(this, new EventArgs());
            trkThrusterOffset_Scroll(this, new EventArgs());
            trkSize_Scroll(this, new EventArgs());
        }
示例#2
0
        public void SetPointers(LargeMapViewer2D picturebox, ShipController shipController, SimpleMap map)
        {
            _picturebox = picturebox;
            _shipController = shipController;
            _map = map;

            shipPropsMain1.SetPointers(picturebox, shipController);
            shipPropsTractor1.SetPointers(shipController, map);
            shipPropsGun1.SetPointers(shipController);

            _shipController.FinishedSetup();

            ShowPropertyTab(shipPropsMain1);
        }
示例#3
0
        private Ball _drawingBall = null;		// ball is the lowest base class.  it could also be solidball or rigidbody

        //private double _diminishPercent = 1d;

        #endregion

        #region Constructor

        public BallAdder(LargeMapViewer2D picturebox, ObjectRenderer renderer, BallProps newBallProps, SimpleMap map, MyVector boundryLower, MyVector boundryUpper, List<long> tempObjects)
        {
            _picturebox = picturebox;
            _renderer = renderer;
            _newBallProps = newBallProps;
            _map = map;
            _boundryLower = boundryLower;
            _boundryUpper = boundryUpper;
            _tempObjects = tempObjects;

            _picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown);
            _picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp);
            _picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove);
        }
示例#4
0
        public GravMouse(LargeMapViewer2D picturebox, SimpleMap map, MyVector boundryLower, MyVector boundryUpper)
        {
            const double RADIUS = 400;

            _picturebox = picturebox;
            _map = map;
            _boundryLower = boundryLower;
            _boundryUpper = boundryUpper;

            _cursorBlip = new BallBlip(new Ball(new MyVector(), new DoubleVector(1, 0, 0, 0, 1, 0), RADIUS, UtilityCore.GetMassForRadius(RADIUS, 1d), 1, 0, 0, _boundryLower, _boundryUpper), CollisionStyle.Stationary, RadarBlipQual.BallUserDefined05, TokenGenerator.NextToken());

            _picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown);
            _picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp);
            _picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove);
            _picturebox.MouseLeave += new EventHandler(picturebox_MouseLeave);
        }
示例#5
0
        public Selector(LargeMapViewer2D picturebox, SimpleMap map, ObjectRenderer renderer, List<long> cantDeleteTokens)
        {
            _picturebox = picturebox;
            _map = map;
            _renderer = renderer;
            _cantDeleteTokens = cantDeleteTokens;

            _picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown);
            _picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp);
            _picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove);

            _picturebox.KeyDown += new KeyEventHandler(picturebox_KeyDown);
            _picturebox.KeyUp += new KeyEventHandler(picturebox_KeyUp);
        }
 public ObjectRenderer(LargeMapViewer2D viewer)
 {
     _viewer = viewer;
 }
            public void Draw(LargeMapViewer2D viewer, Color backColor1, Color backColor2)
            {
                const int ALPHA = 64;
                const double AXISMULT = 1.5d;
                const double AXISWIDTH = 5;

                // Draw Axis
                viewer.DrawLine(Color.Red, AXISWIDTH, this.Position, this.Position + this.Rotation.GetRotatedVector(new MyVector(this.Radius * AXISMULT, 0, 0), true));
                viewer.DrawLine(Color.Green, AXISWIDTH, this.Position, this.Position + this.Rotation.GetRotatedVector(new MyVector(0, this.Radius * AXISMULT, 0), true));
                viewer.DrawLine(Color.Blue, AXISWIDTH, this.Position, this.Position + this.Rotation.GetRotatedVector(new MyVector(0, 0, this.Radius * AXISMULT), true));

                // Draw Polygon
                viewer.FillPolygon(backColor1, backColor2, this.Position, this);

                // Dot Colors
                Color colorRotateX = Color.Red;
                Color colorRotateY = Color.Green;
                Color colorRotateZ = Color.Blue;

                switch (_mouseDown)
                {
                    case MouseDownOnPolygon.Nothing:
                    case MouseDownOnPolygon.Ball:
                        break;

                    case MouseDownOnPolygon.RotateX:
                        colorRotateX = Color.HotPink;
                        break;

                    case MouseDownOnPolygon.RotateY:
                        colorRotateY = Color.Chartreuse;
                        break;

                    case MouseDownOnPolygon.RotateZ:
                        colorRotateZ = Color.LightBlue;
                        break;

                    default:
                        throw new ApplicationException("Unknown MouseDownOnTriangle: " + _mouseDown.ToString());
                }

                colorRotateX = Color.FromArgb(ALPHA, colorRotateX);
                colorRotateY = Color.FromArgb(ALPHA, colorRotateY);
                colorRotateZ = Color.FromArgb(ALPHA, colorRotateZ);
                Color circleColor = Color.FromArgb(ALPHA, Color.Black);

                // Draw Dots
                MyVector point = this.Position + this.RotateHandleX;
                viewer.FillCircle(colorRotateX, point, DOTRADIUS);
                viewer.DrawCircle(circleColor, .5d, point, DOTRADIUS);
                viewer.DrawString("X", _font, _fontBrush, point, ContentAlignment.MiddleCenter);

                point = this.Position + this.RotateHandleY;
                viewer.FillCircle(colorRotateY, point, DOTRADIUS);
                viewer.DrawCircle(circleColor, .5d, point, DOTRADIUS);
                viewer.DrawString("Y", _font, _fontBrush, point, ContentAlignment.MiddleCenter);

                point = this.Position + this.RotateHandleZ;
                viewer.FillCircle(colorRotateZ, point, DOTRADIUS);
                viewer.DrawCircle(circleColor, .5d, point, DOTRADIUS);
                viewer.DrawString("Z", _font, _fontBrush, point, ContentAlignment.MiddleCenter);
            }
            public void Draw(LargeMapViewer2D viewer, Color backColor)
            {
                const double DOTRADIUS = 35;
                const int ALPHA = 64;

                MyVector point1 = this.Position + this.Vertex1;
                MyVector point2 = this.Position + this.Vertex2;
                MyVector point3 = this.Position + this.Vertex3;

                // Draw Triangle
                viewer.FillTriangle(backColor, point1, point2, point3);
                viewer.DrawTriangle(Color.Black, 1, point1, point2, point3);

                // Dot Colors
                Color color1 = point1.Z < -1 ? Color.Black : point1.Z > 1 ? Color.White : Color.MediumPurple;
                Color color2 = point2.Z < -1 ? Color.Black : point2.Z > 1 ? Color.White : Color.MediumPurple;
                Color color3 = point3.Z < -1 ? Color.Black : point3.Z > 1 ? Color.White : Color.MediumPurple;
                Color colorRotate = Color.DarkSeaGreen;

                switch (_mouseDown)
                {
                    case MouseDownOnTriangle.Nothing:
                    case MouseDownOnTriangle.Ball:
                        break;

                    case MouseDownOnTriangle.Point1:
                        color1 = Color.Silver;
                        break;

                    case MouseDownOnTriangle.Point2:
                        color2 = Color.Silver;
                        break;

                    case MouseDownOnTriangle.Point3:
                        color3 = Color.Silver;
                        break;

                    case MouseDownOnTriangle.Rotate:
                        colorRotate = Color.Chartreuse;
                        break;

                    default:
                        throw new ApplicationException("Unknown MouseDownOnTriangle: " + _mouseDown.ToString());
                }

                color1 = Color.FromArgb(ALPHA, color1);
                color2 = Color.FromArgb(ALPHA, color2);
                color3 = Color.FromArgb(ALPHA, color3);
                colorRotate = Color.FromArgb(ALPHA, colorRotate);
                Color circleColor = Color.FromArgb(ALPHA, Color.Black);

                // Draw Dots
                viewer.FillCircle(color1, point1, DOTRADIUS);
                viewer.DrawCircle(circleColor, .5d, point1, DOTRADIUS);
                viewer.DrawString("1", _font, _fontBrush, point1, ContentAlignment.MiddleCenter);

                viewer.FillCircle(color2, point2, DOTRADIUS);
                viewer.DrawCircle(circleColor, .5d, point2, DOTRADIUS);
                viewer.DrawString("2", _font, _fontBrush, point2, ContentAlignment.MiddleCenter);

                viewer.FillCircle(color3, point3, DOTRADIUS);
                viewer.DrawCircle(circleColor, .5d, point3, DOTRADIUS);
                viewer.DrawString("3", _font, _fontBrush, point3, ContentAlignment.MiddleCenter);

                MyVector pointRotate = this.Position + this.Rotation.GetRotatedVector(_rotateHandle, true);

                viewer.FillCircle(colorRotate, pointRotate, DOTRADIUS);
                viewer.DrawCircle(circleColor, .5d, pointRotate, DOTRADIUS);
            }
        public ShipController(LargeMapViewer2D picturebox, SimpleMap map, MyVector boundryLower, MyVector boundryUpper)
        {
            _picturebox = picturebox;
            _map = map;
            _boundryLower = boundryLower;
            _boundryUpper = boundryUpper;

            _blipToken = TokenGenerator.NextToken();

            _picturebox.KeyDown += new System.Windows.Forms.KeyEventHandler(Picturebox_KeyDown);
            _picturebox.KeyUp += new System.Windows.Forms.KeyEventHandler(Picturebox_KeyUp);
        }