Example #1
0
        private void UpdateMouseInput(GameTime gameTime)
        {
            bool       manipulated = false;
            MouseState mouseState  = Mouse.GetState();

            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                Vector3 positionCenter = CurrentVisual2DResize.PositionCenterEngine;
                float   distanceX      = Math.Abs(CurrentVisual2DResize.RectangleArea.X - mouseState.X);
                float   distanceY      = Math.Abs(CurrentVisual2DResize.RectangleArea.Y - mouseState.Y);
                _currentSelectedDrawable = GetMatchedSelectedBox();
                if (_currentSelectedDrawable != null)
                {
                    manipulated = ManipulateResizing(positionCenter, distanceY, distanceX);
                }
                _canSelectNewBox = false;
            }
            if (!manipulated)
            {
                ManipulateRotating();
            }
            if (mouseState.LeftButton == ButtonState.Released)
            {
                _canSelectNewBox = true;
            }
        }
Example #2
0
        public void Draw(GameTime gameTime)
        {
            Vector3           posXna1           = this.Mass1.PositionXNACenter;
            Vector3           posXna2           = this.Mass2.PositionXNACenter;
            Vector3           posPointer        = posXna2 - posXna1;
            Visual2DRotatable visual2DRotatable = new Visual2DRotatable(posXna1 - (posPointer / 10), //- (posXna1 / 4),
                                                                        posXna2 + (posPointer / 10), //+ (posXna2 / 4),
                                                                        3,
                                                                        TextureType.RealRope);

            visual2DRotatable.Draw(gameTime);
            //visual2DRotatable.Draw(gameTime, Color.);
        }
Example #3
0
 public void Draw(GameTime gameTime)
 {
     for (int i = 0; i < this.ListOfMasses.Count - 1; i++)
     {
         Vector3           posXna1           = ListOfMasses[i].PositionCenterEngine;
         Vector3           posXna2           = ListOfMasses[i + 1].PositionCenterEngine;
         Visual2DRotatable visual2DRotatable = new Visual2DRotatable(posXna1, posXna2, 1, TextureType.DefaultBox);
         visual2DRotatable.Draw(gameTime);
     }
     if (IsClosed)
     {
         Vector3           posXna1           = ListOfMasses[0].PositionCenterEngine;
         Vector3           posXna2           = ListOfMasses[ListOfMasses.Count - 1].PositionCenterEngine;
         Visual2DRotatable visual2DRotatable = new Visual2DRotatable(posXna1, posXna2, 1, TextureType.DefaultBox);
         visual2DRotatable.Draw(gameTime);
     }
 }
Example #4
0
        private Visual2DRotatable GetMatchedSelectedBox()
        {
            Visual2DRotatable catchedRotatable = null;
            MouseState        mouseState       = Mouse.GetState();

            if (_canSelectNewBox)
            {
                Vector2         mousePosition      = new Vector2(mouseState.X, mouseState.Y);
                List <Visual2D> listOfVisual2DTags = new List <Visual2D>();
                listOfVisual2DTags.AddRange(_listOfTags);
                Visual2D catechedDrawable = MouseManager.CatchDrawableComponent(mousePosition, listOfVisual2DTags);
                if (catechedDrawable is Visual2DRotatable)
                {
                    catchedRotatable = catechedDrawable as Visual2DRotatable;
                }
            }
            else
            {
                catchedRotatable = _currentSelectedDrawable;
            }
            return(catchedRotatable);
        }