Пример #1
0
        public static void MouseDown(Vector2 position)
        {
            //lastMouseDownPos = position;
            switch (Mousemode)
            {
                case MouseMode.Select:
                    //if (GetCircleAABB(startPoint.Position, StartPoint.radius).Contains((int)position.X, (int)position.Y))
                    //startPoint.SetPosition(position);
                    if (GetCircleAABB(startPoint.Position, StartPoint.radius).ContainsVector(position))
                    //if (startPoint.ContainsPoint(position))
                    {
                        CurrentObject = startPoint;
                        CurrentObjectOffset =  CurrentObject.GetPosition() - position;
                    }
                    break;

                case MouseMode.DrawRectangle:
                    tempRectangle = new PhysicsRectangle(position, position *2, 0);
                    tempRectangle.TopLeft = position;
                    break;
                case MouseMode.DrawRectangleRotate:
                    //tempRectangle = new PhysicsRectangle(position, Vector2.Zero, 0);
                    tempRectangle.Rotation = (float)Math.Atan2(rotatePoint.Y - position.Y, rotatePoint.X - position.X);
                    CurrentLevel.Rectangles.Add(tempRectangle);
                    tempRectangle = PhysicsRectangle.Empty;
                    Mousemode = MouseMode.Select;
                    break;
            }
        }