public void ReactToXnaInitialize(SystemManagers managers)
 {
     foreach (var component in mComponents.Where((component) => component.ReactToXnaInitialize != null))
     {
         component.ReactToXnaInitialize(managers);
     }
 }
        public void HandleXnaInitialize(SystemManagers managers)
        {
            mManagers = managers;

            mSprite = new Sprite(null);
            mSprite.Visible = false;
            mManagers.SpriteManager.Add(mSprite);

            mOutlineRectangle = new RenderingLibrary.Math.Geometry.LineRectangle(mManagers);
            mOutlineRectangle.Visible = false;
            mManagers.ShapeManager.Add(mOutlineRectangle);
            mOutlineRectangle.Color = new Microsoft.Xna.Framework.Color(
                1.0f, 1.0f, 1.0f, .5f);

            mHighlightRectangle = new RenderingLibrary.Math.Geometry.LineRectangle(mManagers);
            mHighlightRectangle.Visible = false;
            mManagers.ShapeManager.Add(mHighlightRectangle);
            mHighlightRectangle.Color = new Microsoft.Xna.Framework.Color(
                1.0f, 1.0f, 1.0f, 1.0f);

            HandleWindowResize();
            mCursor = new InputLibrary.Cursor();
            mCursor.Initialize(mControl);
            mCameraPanningLogic = new CameraPanningLogic(mControl, managers, mCursor, mKeyboard);
            mCameraPanningLogic.Panning += delegate
            {
                ApplicationEvents.Self.CallAfterWireframePanning();
            };

            mManagers.Renderer.Camera.CameraCenterOnScreen = CameraCenterOnScreen.TopLeft;
            mManagers.Renderer.SamplerState = Microsoft.Xna.Framework.Graphics.SamplerState.PointClamp;

            mControl.KeyDown += HandleXnaControlKeyDown;
            mControl.KeyPress += HandleXnaControlKeyPress;
        }
        public void HandleXnaInitialize(SystemManagers managers)
        {
            mManagers = managers;

            mSprite = new Sprite(null);
            mSprite.Visible = false;
            mManagers.SpriteManager.Add(mSprite);

            mOutlineRectangle = new RenderingLibrary.Math.Geometry.LineRectangle(mManagers);
            mOutlineRectangle.Visible = false;
            mManagers.ShapeManager.Add(mOutlineRectangle);
            mOutlineRectangle.Color = new Microsoft.Xna.Framework.Color(
                1.0f, 1.0f, 1.0f, .5f);

            mHighlightRectangle = new RenderingLibrary.Math.Geometry.LineRectangle(mManagers);
            mHighlightRectangle.Visible = false;
            mManagers.ShapeManager.Add(mHighlightRectangle);
            mHighlightRectangle.Color = new Microsoft.Xna.Framework.Color(
                1.0f, 1.0f, 1.0f, 1.0f);

            HandleWindowResize();
            mCursor = new InputLibrary.Cursor();
            mCursor.Initialize(mControl);
            mCameraPanningLogic = new CameraPanningLogic(mControl, managers, mCursor, mKeyboard);
            mManagers.Renderer.SamplerState = Microsoft.Xna.Framework.Graphics.SamplerState.PointClamp;
        }
        public static GraphicalUiElement ToGraphicalUiElement(this InstanceSave instanceSave, SystemManagers systemManagers)
        {
            ElementSave instanceElement = ObjectFinder.Self.GetElementSave(instanceSave.BaseType);

            GraphicalUiElement toReturn = null;
            if (instanceElement != null)
            {
                toReturn = ElementSaveExtensions.CreateGueForElement(instanceElement);

                GumRuntime.ElementSaveExtensions.SetGraphicalUiElement(instanceElement, toReturn, systemManagers);

                toReturn.Name = instanceSave.Name;
                toReturn.Tag = instanceSave;

                var state = instanceSave.ParentContainer.DefaultState;

                foreach (var variable in state.Variables.Where(item => item.SourceObject == instanceSave.Name))
                {
                    string propertyOnInstance = variable.Name.Substring(variable.Name.LastIndexOf('.') + 1);

                    if (toReturn.IsExposedVariable(propertyOnInstance))
                    {
                        toReturn.SetProperty(propertyOnInstance, variable.Value);
                    }
                }
            }

            return toReturn;
        }
        public StatusTextController(SystemManagers systemManagers)
        {
            mManagers = systemManagers;
            mText = new Text(systemManagers, "Unset Text");
            mText.RenderBoundary = false;
            systemManagers.TextManager.Add(mText);

            UpdateText();
        }
        public static float GetWorldY(this Cursor cursor, SystemManagers managers)
        {
            Vector3 transformed = new Vector3(cursor.X, cursor.Y, 0);
            Matrix matrix = managers.Renderer.Camera.GetTransformationMatrix();
            matrix = Matrix.Invert(matrix);

            TransformVector(ref transformed, ref matrix);

            return transformed.Y;
        }
        internal static bool TryHandleAsBaseType(string baseType, SystemManagers systemManagers, out IRenderable containedObject)
        {
            bool handledAsBaseType = true;
            containedObject = null;

            switch (baseType)
            {

                case "Container":

                    LineRectangle lineRectangle = new LineRectangle(systemManagers);
                    containedObject = lineRectangle;
                    break;

                case "Rectangle":
                    LineRectangle rectangle = new LineRectangle();
                    rectangle.IsDotted = false;
                    containedObject = rectangle;
                    break;
                case "Circle":
                    LineCircle circle = new LineCircle();
                    circle.CircleOrigin = CircleOrigin.TopLeft;
                    containedObject = circle;
                    break;

                case "ColoredRectangle":
                    SolidRectangle solidRectangle = new SolidRectangle();
                    containedObject = solidRectangle;
                    break;
                case "Sprite":
                    Texture2D texture = null;

                    Sprite sprite = new Sprite(texture);
                    containedObject = sprite;

                    break;
                case "NineSlice":
                    {
                        NineSlice nineSlice = new NineSlice();
                        containedObject = nineSlice;
                    }
                    break;
                case "Text":
                    {
                        Text text = new Text(systemManagers, "");
                        containedObject = text;
                    }
                    break;
                default:
                    handledAsBaseType = false;
                    break;
            }

            return handledAsBaseType;
        }
Example #8
0
        public CameraController(RenderingLibrary.Camera camera, SystemManagers managers, Cursor cursor, GraphicsDeviceControl control, Ruler topRuler, Ruler leftRuler)
        {
            this.TopRuler = topRuler;
            this.LeftRuler = leftRuler;
            Cursor = cursor;
            Camera = camera;
            Managers = managers;

            cameraPanningLogic = new CameraPanningLogic(control, managers, cursor, null);

        }
        public CameraPanningLogic(GraphicsDeviceControl graphicsControl, SystemManagers managers, Cursor cursor, Keyboard keyboard)
        {
            mManagers = managers;

            mKeyboard = keyboard;

            mCursor = cursor;
            mCursor.Initialize(graphicsControl);
            mCamera = managers.Renderer.Camera;
            mControl = graphicsControl;
            graphicsControl.XnaUpdate += new Action(Activity);
        }
        public static GraphicalUiElement ToGraphicalUiElement(this ElementSave elementSave, SystemManagers systemManagers, 
            bool addToManagers)
        {
            GraphicalUiElement toReturn = CreateGueForElement(elementSave);

            elementSave.SetGraphicalUiElement(toReturn, systemManagers);

            //no layering support yet
            if (addToManagers)
            {
                toReturn.AddToManagers(systemManagers, null);
            }

            return toReturn;
        }
        public static void SetGraphicalUiElement(this ElementSave elementSave, GraphicalUiElement toReturn, SystemManagers systemManagers)
        {
            // We need to set categories and states first since those are used below;
            toReturn.SetStatesAndCategoriesRecursively(elementSave);

            toReturn.CreateGraphicalComponent(elementSave, systemManagers);

            toReturn.AddExposedVariablesRecursively(elementSave);

            toReturn.CreateChildrenRecursively(elementSave, systemManagers);

            toReturn.Tag = elementSave;

            toReturn.SetVariablesRecursively(elementSave);
        }
Example #12
0
        public static float GetWorldY(this Cursor cursor, SystemManagers managers = null)
        {
            Renderer renderer = null;
            if (managers == null)
            {
                renderer = Renderer.Self;
            }
            else
            {
                renderer = managers.Renderer;
            }

            float worldX, worldY;
            renderer.Camera.ScreenToWorld(cursor.X, cursor.Y, out worldX, out worldY);

            return worldY;
        }
Example #13
0
        public static SystemManagers CreateFromSingletons()
        {
            SystemManagers systemManagers = new SystemManagers();

            systemManagers.mPrimaryThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;


            systemManagers.Renderer      = Renderer.Self;
            systemManagers.SpriteManager = SpriteManager.Self;
            systemManagers.ShapeManager  = ShapeManager.Self;
            systemManagers.TextManager   = TextManager.Self;

            systemManagers.SpriteManager.Managers = systemManagers;
            systemManagers.ShapeManager.Managers  = systemManagers;
            systemManagers.TextManager.Managers   = systemManagers;

            return(systemManagers);
        }
        public TilePropertyHighlight(SystemManagers managers)
        {
            Children = new List<IRenderableIpso>();
            mManagers = managers;
            mLineRectangle = new LineRectangle(mManagers);
            mLineRectangle.Width = 16;
            mLineRectangle.Height = 16;
            mLineRectangle.Z = 1;
            mLineRectangle.Parent = this;

            mLineRectangle.Color = new Microsoft.Xna.Framework.Color(1, 1, 1, .3f);

            mCountDisplay = new Text(mManagers, "99");
            mCountDisplay.HorizontalAlignment = HorizontalAlignment.Left;
            mCountDisplay.VerticalAlignment = VerticalAlignment.Top;
            mCountDisplay.Z = 1;
            mCountDisplay.Parent = this;
        }
Example #15
0
        public static SystemManagers CreateFromSingletons()
        {
            SystemManagers systemManagers = new SystemManagers();

            #if WINDOWS_8
            systemManagers.mPrimaryThreadId = Environment.CurrentManagedThreadId;
            #else
            systemManagers.mPrimaryThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
            #endif

            systemManagers.Renderer = Renderer.Self;
            systemManagers.SpriteManager = SpriteManager.Self;
            systemManagers.ShapeManager = ShapeManager.Self;
            systemManagers.TextManager = TextManager.Self;

            systemManagers.SpriteManager.Managers = systemManagers;
            systemManagers.ShapeManager.Managers = systemManagers;
            systemManagers.TextManager.Managers = systemManagers;

            return systemManagers;
        }
Example #16
0
        public static SystemManagers CreateFromSingletons()
        {
            SystemManagers systemManagers = new SystemManagers();

#if WINDOWS_8 || UWP
            systemManagers.mPrimaryThreadId = Environment.CurrentManagedThreadId;
#else
            systemManagers.mPrimaryThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
#endif


            systemManagers.Renderer      = Renderer.Self;
            systemManagers.SpriteManager = SpriteManager.Self;
            systemManagers.ShapeManager  = ShapeManager.Self;
            systemManagers.TextManager   = TextManager.Self;

            systemManagers.SpriteManager.Managers = systemManagers;
            systemManagers.ShapeManager.Managers  = systemManagers;
            systemManagers.TextManager.Managers   = systemManagers;

            return(systemManagers);
        }
Example #17
0
        public Ruler(GraphicsDeviceControl control, SystemManagers managers, Cursor cursor )
        {
            try
            {
                mControl = control;
                mManagers = managers;
                mCursor = cursor;

                CreateLayer();

                CreateVisualRepresentation();

                // Create the text after the Layer
                CreateGuideText();

                RulerSide = Wireframe.RulerSide.Top;
            }
            catch(Exception e)
            {
                throw e;
            }
        }
        public static void CreateGraphicalComponent(this GraphicalUiElement graphicalElement, ElementSave elementSave, SystemManagers systemManagers)
        {
            IRenderable containedObject = null;

            bool handled = InstanceSaveExtensionMethods.TryHandleAsBaseType(elementSave.Name, systemManagers, out containedObject);

            if (handled)
            {
                graphicalElement.SetContainedObject(containedObject);
            }
            else
            {
                if (elementSave != null && elementSave is ComponentSave)
                {
                    var baseElement = Gum.Managers.ObjectFinder.Self.GetElementSave(elementSave.BaseType);

                    if (baseElement != null)
                    {
                        graphicalElement.CreateGraphicalComponent(baseElement, systemManagers);
                    }
                }
            }
        }
 private void CreateManagers()
 {
     // For now we'll just use one SystemManagers but we may need to expand this if we have two windows
     mManagers = this.XnaControl.SystemManagers;
     //new SystemManagers();
     //mManagers.Initialize(XnaControl.GraphicsDevice);
 }
        public void CustomInitialize()
        {
            mTimeManager = new TimeManager();


            mManagers = new SystemManagers();
            mManagers.Initialize(GraphicsDevice);
            mManagers.Name = "Image Region Selection";
            Assembly assembly = Assembly.GetAssembly(typeof(GraphicsDeviceControl));// Assembly.GetCallingAssembly();

            string targetFntFileName = FileManager.UserApplicationDataForThisApplication + "Font18Arial.fnt";
            string targetPngFileName = FileManager.UserApplicationDataForThisApplication + "Font18Arial_0.png";
            FileManager.SaveEmbeddedResource(
                assembly,
                "XnaAndWinforms.Content.Font18Arial.fnt",
                targetFntFileName);

            FileManager.SaveEmbeddedResource(
                assembly,
                "XnaAndWinforms.Content.Font18Arial_0.png",
                targetPngFileName);



            var contentLoader = new ContentLoader();
            contentLoader.SystemManagers = mManagers;

            LoaderManager.Self.ContentLoader = contentLoader;
            LoaderManager.Self.Initialize("Content/InvalidTexture.png", targetFntFileName, Services, mManagers);

            CreateNewSelector();

            mCursor = new InputLibrary.Cursor();
            mCursor.Initialize(this);

            mKeyboard = new InputLibrary.Keyboard();
            mKeyboard.Initialize(this);

            mCameraPanningLogic = new CameraPanningLogic(this, mManagers, mCursor, mKeyboard);
            mCameraPanningLogic.Panning += HandlePanning;



            MouseWheel += new MouseEventHandler(MouseWheelRegion);
            ZoomNumbers = new Zooming.ZoomNumbers();
        }
 void IRenderable.Render(SpriteRenderer spriteRenderer, SystemManagers managers)
 {
     mContainedObjectAsIpso.Render(spriteRenderer, managers);
 }
Example #22
0
        public static void StaticInitialize(string projectFileName)
        {
            if (mManagers == null)
            {
                mManagers = new SystemManagers();
                mManagers.Initialize(FlatRedBallServices.GraphicsDevice);
                mManagers.Renderer.Camera.AbsoluteLeft = 0;
                mManagers.Renderer.Camera.AbsoluteTop = 0;

                var viewport = mManagers.Renderer.GraphicsDevice.Viewport;
                viewport.Width = FlatRedBall.Math.MathFunctions.RoundToInt(FlatRedBall.Camera.Main.DestinationRectangle.Width);
                viewport.Height = FlatRedBall.Math.MathFunctions.RoundToInt(FlatRedBall.Camera.Main.DestinationRectangle.Height);
                mManagers.Renderer.GraphicsDevice.Viewport = viewport;

                if (FlatRedBall.Camera.Main.Orthogonal)
                {
                    GraphicalUiElement.CanvasHeight = FlatRedBall.Camera.Main.OrthogonalHeight;
                    GraphicalUiElement.CanvasWidth = FlatRedBall.Camera.Main.OrthogonalWidth;
                }
                else
                {
                    GraphicalUiElement.CanvasHeight = FlatRedBall.Camera.Main.DestinationRectangle.Height;
                    GraphicalUiElement.CanvasWidth = FlatRedBall.Camera.Main.DestinationRectangle.Width;
                }

                // Need to do the zoom here in response to the FRB camera vs. the Gum camera
                mManagers.Renderer.Camera.Zoom = viewport.Height / (float)GraphicalUiElement.CanvasHeight;
                mManagers.Renderer.Camera.CameraCenterOnScreen = CameraCenterOnScreen.TopLeft;
                mManagers.Renderer.Camera.X = 0;
                mManagers.Renderer.Camera.Y = 0;

                SystemManagers.Default = mManagers;
                FlatRedBallServices.AddManager(RenderingLibrary.SystemManagers.Default);

                RenderingLibrary.Graphics.Text.RenderBoundaryDefault = false;
                // FlatRedBall uses premult alpha.
                RenderingLibrary.Graphics.Renderer.NormalBlendState = Microsoft.Xna.Framework.Graphics.BlendState.AlphaBlend;


                var idb = new GumIdb();
                // We don't want the UI to be at Z=0 because it will render 
                // at the same Z along with FRB entities and environments so UI might 
                // be hidden. The proper way to solve this is to use Layers, but
                // this shouldn't be creating new Layers, that's up to the user.
                // Let's make it have a positive Z so it draws in more things at once 
                idb.Z = 10;

                // This could be called on a secondary thread, like if called by GlobalContent, so we
                // want this to happen on the primary thread:
                Action primaryThreadAction = () =>
                {
                    FlatRedBall.SpriteManager.AddDrawableBatch(idb);
                    FlatRedBall.Screens.ScreenManager.PersistentDrawableBatches.Add(idb);
                };

                var instruction = new FlatRedBall.Instructions.DelegateInstruction(primaryThreadAction);
                FlatRedBall.Instructions.InstructionManager.Add(instruction);

            }

            if (projectFileName == null)
            {
                throw new Exception("The GumIDB must be initialized with a valid (non-null) project file.");
            }

            string errors;
            mProjectFileName = projectFileName;

            if (FlatRedBall.IO.FileManager.IsRelative(mProjectFileName))
            {
                mProjectFileName = FlatRedBall.IO.FileManager.RelativeDirectory + mProjectFileName;
            }

            // First let's set the relative directory to the file manager's relative directory so we can load
            // the file normally...
            ToolsUtilities.FileManager.RelativeDirectory = FlatRedBall.IO.FileManager.RelativeDirectory;

            GumLoadResult result;

            ObjectFinder.Self.GumProjectSave = GumProjectSave.Load(mProjectFileName, out result);

#if DEBUG
            if(ObjectFinder.Self.GumProjectSave == null)
            {
                throw new Exception("Could not find Gum project at " + mProjectFileName);
            }

            if(!string.IsNullOrEmpty(result.ErrorMessage))
            {
                throw new Exception(result.ErrorMessage);

            }

            if(result.MissingFiles.Count != 0)
            {
                throw new Exception("Missing files starting with " + result.MissingFiles[0]);
            }
#endif

            // Now we can set the directory to Gum's root:
            ToolsUtilities.FileManager.RelativeDirectory = ToolsUtilities.FileManager.GetDirectory(mProjectFileName);

            // The Gum tool does a lot more init than this, but we're going to only do a subset 
            //of initialization for performance
            // reasons:
            foreach (var item in ObjectFinder.Self.GumProjectSave.Screens)
            {
                // Only initialize using the default state
                if (item.DefaultState != null)
                {
                    item.Initialize(item.DefaultState);
                }
            }
            foreach (var item in ObjectFinder.Self.GumProjectSave.Components)
            {
                // Only initialize using the default state
                if (item.DefaultState != null)
                {
                    item.Initialize(item.DefaultState);
                }
            }
            foreach (var item in ObjectFinder.Self.GumProjectSave.StandardElements)
            {
                // Only initialize using the default state
                if (item.DefaultState != null)
                {
                    item.Initialize(item.DefaultState);
                }
                //for atlased colored rectangles
                if (item.Name == "ColoredRectangle")
                    RenderingLibrary.Graphics.SolidRectangle.AtlasedTextureName = "..\\Graphics\\Misc\\ColoredRectangle.png";
            }

            StandardElementsManager.Self.Initialize();
        }
        private void DragActivity(Cursor cursor, SystemManagers managers)
        {
            if (cursor.PrimaryDown && 
                (cursor.XChange != 0 || cursor.YChange != 0) &&
                mSideGrabbed != ResizeSide.None)
            {
                RecordOldValues();

                float widthMultiplier = 0;
                float heightMultiplier = 0;
                float xMultiplier = 0;
                float yMultiplier = 0;

                GetMultipliersFromSideGrabbed(ref widthMultiplier, ref heightMultiplier, ref xMultiplier, ref yMultiplier);

                xMultiplier /= managers.Renderer.Camera.Zoom;
                yMultiplier /= managers.Renderer.Camera.Zoom;
                widthMultiplier /= managers.Renderer.Camera.Zoom;
                heightMultiplier /= managers.Renderer.Camera.Zoom;


                this.Left = mCoordinates.X + xMultiplier * cursor.XChange;
                this.Top = mCoordinates.Y + yMultiplier * cursor.YChange;
                this.Width = mCoordinates.Width + widthMultiplier * cursor.XChange;
                this.Height = mCoordinates.Height + heightMultiplier * cursor.YChange;

                if (RegionChanged != null)
                {
                    RegionChanged(this, null);
                }
            }




        }
        public void Initialize(ImageRegionSelectionControl control, SystemManagers managers, WireframeEditControls wireframeControl)
        {
            mManagers = managers;
            mManagers.Renderer.SamplerState = SamplerState.PointClamp;


            mControl = control;


            mManagers.Renderer.Camera.CameraCenterOnScreen = CameraCenterOnScreen.TopLeft;

            mWireframeControl = wireframeControl;
            mWireframeControl.WandSelectionChanged += ReactToMagicWandChange;

            mControl.RegionChanged += new EventHandler(HandleRegionChanged);

            mControl.MouseWheelZoom += new EventHandler(HandleMouseWheelZoom);
            mControl.AvailableZoomLevels = mWireframeControl.AvailableZoomLevels;

            mControl.XnaUpdate += new Action(HandleXnaUpdate);
            mControl.Panning += HandlePanning;

            mSpriteOutline = new LineRectangle(managers);
            managers.ShapeManager.Add(mSpriteOutline);
            mSpriteOutline.Visible = false;
            mSpriteOutline.Color = OutlineColor;

            mLineGrid = new LineGrid(managers);
            managers.ShapeManager.Add(mLineGrid);
            mLineGrid.Visible = false;
            mLineGrid.Color = OutlineColor;

            mControl.Click += new EventHandler(HandleClick);

            mStatusText = new StatusTextController(managers);
            mControl_XnaInitialize();
        }
        private void MouseAndCursorActivity(Cursor cursor, System.Windows.Forms.Control container, SystemManagers managers)
        {
            if (mVisible && cursor.IsInWindow)
            {


                float worldX = cursor.GetWorldX(managers);
                float worldY = cursor.GetWorldY(managers);

                var sideOver = GetSideOver(
                    worldX,
                    worldY);



                SetWindowsCursor(container, mSideGrabbed, sideOver, ResetsCursorIfNotOver);

                PushActivity(sideOver, cursor);

                DragActivity(cursor, managers);

                ClickActivity(cursor);
            }
            else
            {
                //WinCursor.Current = Cursors.Arrow;
                if (ResetsCursorIfNotOver)
                {
                    container.Cursor = Cursors.Arrow;
                }
            }
        }
        private void ResizeCircleActivity(SystemManagers managers)
        {
            if (Visible && ShowHandles)
            {

                foreach (var handle in mHandles)
                {
                    handle.Radius = HandleSize / managers.Renderer.Camera.Zoom;
                }


            }
        }
        public void Activity(Cursor cursor, Keyboard keyboard, System.Windows.Forms.Control container, SystemManagers managers)
        {
            MouseAndCursorActivity(cursor, container, managers);
            
            KeyboardActivity(keyboard);

            // Resize even if the cursor isn't in the window - because these may have been made visible by clicking on some winforms UI and we want
            // the size to be properly set
            ResizeCircleActivity(managers);

        }
        public void RemoveFromManagers(SystemManagers managers)
        {
            mLineRectangle.Z = 1;
            managers.ShapeManager.Remove(mLineRectangle);

            foreach (var circle in mHandles)
            {
                managers.ShapeManager.Remove(circle);
            }
        }
        public void AddToManagers(SystemManagers managers)
        {
            mLineRectangle.Z = 1;
            managers.ShapeManager.Add(mLineRectangle);

            foreach (var circle in mHandles)
            {
                circle.Z = 1;
                managers.ShapeManager.Add(circle);
            }
        }
 public void Render(SpriteRenderer spriteRenderer, SystemManagers managers)
 {
     throw new NotImplementedException();
 }
Example #31
0
 public Camera(SystemManagers managers)
 {
     Zoom      = 1;
     mManagers = managers;
     UpdateClient();
 }
        public bool HasCursorOver(Cursor cursor, SystemManagers managers)
        {
            float worldX = cursor.GetWorldX(managers);
            float worldY = cursor.GetWorldY(managers);
            if (this.mLineRectangle.HasCursorOver(worldX, worldY))
            {
                return true;
            }

            if (mShowHandles)
            {
                foreach (var circle in mHandles)
                {
                    if (circle.HasCursorOver(worldX, worldY))
                    {
                        return true;
                    }
                }
            }

            return false;
        }
        public RectangleSelector(SystemManagers managers)
        {
            HandleSize = 4;
            ResetsCursorIfNotOver = true;
            mShowHandles = true;
            mHandles = new List<LineCircle>();
            mLineRectangle = new LineRectangle(managers);

            for (int i = 0; i < 8; i++)
            {
                LineCircle lineCircle = new LineCircle(managers);
                lineCircle.Radius = HandleSize;
                mHandles.Add(lineCircle);
            }

            Width = 34;
            Height = 34;
        }