Example #1
0
        public GameForm() : base()
        {
            //set the window caption.  This should be the name of your game with version number.
            //Edit your assembly info to alter your version number of your game
            this.Text = "ParticleEditor - Editing unsaved .emix";

            camera = SpriteManager.Cameras[0];

            cursor = GuiManager.Cursor;

            FlatRedBallServices.Update();


            gameData = new EditorData();

            gameData.Initialize(this);


            EditorData.guiData.Initialize();



            GuiData.Messages.Initialize(this);

            GuiManager.RefreshTextSize();
        }
Example #2
0
		public GameForm() : base()
		{

			//set the window caption.  This should be the name of your game with version number.  
			//Edit your assembly info to alter your version number of your game
            this.Text = "ParticleEditor - Editing unsaved .emix";

            camera = SpriteManager.Cameras[0];

            cursor = GuiManager.Cursor;

            FlatRedBallServices.Update();


			gameData = new EditorData();

			gameData.Initialize(this);


                EditorData.guiData.Initialize();



			GuiData.Messages.Initialize(this);

            GuiManager.RefreshTextSize();
		}
        private ElementRuntime GetElementRuntimeOver(FlatRedBall.Gui.Cursor cursor)
        {
            ElementRuntime toReturn = null;

            var currentElementRuntime = ArrowState.Self.CurrentContainedElementRuntime;

            if (currentElementRuntime != null && currentElementRuntime.HasCursorOver(cursor))
            {
                toReturn = currentElementRuntime;
            }

            if (toReturn == null && ArrowState.Self.CurrentElementRuntime != null)
            {
                foreach (var containedElementRuntime in ArrowState.Self.CurrentElementRuntime.ContainedElements)
                {
                    if (containedElementRuntime != currentElementRuntime && containedElementRuntime.HasCursorOver(cursor))
                    {
                        toReturn = containedElementRuntime;
                        break;
                    }
                }
            }

            if (toReturn == null)
            {
            }

            return(toReturn);
        }
Example #4
0
        public SaveUseWindow(Cursor cursor)
            : base(cursor)
        {
            mComboBox = new ComboBox(cursor);
            mSaveButton = new Button(cursor);

            AddWindow(mComboBox);
            AddWindow(mSaveButton);

            ScaleX = 9;
            ScaleY = 3.5f;

            mComboBox.Y = 2;
            mSaveButton.Y = 4.5f;

            mSaveButton.Text = "Save";

            mComboBox.ScaleX = 8.5f;
            mSaveButton.ScaleX = mComboBox.ScaleX;

            mComboBox.X = .5f + mComboBox.ScaleX;
            mSaveButton.X = .5f + mSaveButton.ScaleX;            

            mSaveButton.Click += new GuiMessage(SaveButtonClick);
            mComboBox.ItemClick += new GuiMessage(ComboBoxItemClick);

        }
Example #5
0
 public virtual bool HasCursorOver(FlatRedBall.Gui.Cursor cursor)
 {
     if (mIsPaused)
     {
         return(false);
     }
     if (!AbsoluteVisible)
     {
         return(false);
     }
     if (LayerProvidedByContainer != null && LayerProvidedByContainer.Visible == false)
     {
         return(false);
     }
     if (!cursor.IsOn(LayerProvidedByContainer))
     {
         return(false);
     }
     if (BackgroundSprite.Alpha != 0 && BackgroundSprite.AbsoluteVisible && cursor.IsOn3D(BackgroundSprite, LayerProvidedByContainer))
     {
         return(true);
     }
     if (SpriteInstance.Alpha != 0 && SpriteInstance.AbsoluteVisible && cursor.IsOn3D(SpriteInstance, LayerProvidedByContainer))
     {
         return(true);
     }
     return(false);
 }
 public override bool HasCursorOver(FlatRedBall.Gui.Cursor cursor)
 {
     if (base.HasCursorOver(cursor))
     {
         return(true);
     }
     if (mIsPaused)
     {
         return(false);
     }
     if (!AbsoluteVisible)
     {
         return(false);
     }
     if (LayerProvidedByContainer != null && LayerProvidedByContainer.Visible == false)
     {
         return(false);
     }
     if (!cursor.IsOn(LayerProvidedByContainer))
     {
         return(false);
     }
     if (SpriteInstance.Alpha != 0 && SpriteInstance.AbsoluteVisible && cursor.IsOn3D(SpriteInstance, LayerProvidedByContainer))
     {
         return(true);
     }
     if (LightSprite.Alpha != 0 && LightSprite.AbsoluteVisible && cursor.IsOn3D(LightSprite, LayerProvidedByContainer))
     {
         return(true);
     }
     return(false);
 }
Example #7
0
        public SpriteGridBorder(Cursor cursor, Camera camera)
        {
            this.cursor = cursor;
            this.camera = camera;

            mMainRectangle = Polygon.CreateRectangle(1,1);
            ShapeManager.AddPolygon(mMainRectangle);



            mCornerHandles = new Polygon[4];
            mSideHandles = new Polygon[4];
            for (int i = 0; i < 4; i++)
            {
                mCornerHandles[i] = Polygon.CreateRectangle(.5f, .5f);
                mCornerHandles[i].Color = System.Drawing.Color.Yellow;
                ShapeManager.AddPolygon(mCornerHandles[i]);

                mSideHandles[i] = Polygon.CreateRectangle(.5f, .5f);
                mSideHandles[i].Color = System.Drawing.Color.Yellow;
                ShapeManager.AddPolygon(mSideHandles[i]);
            }
             
            Visible = false;
        }
Example #8
0
 public InfoBarWindow(Cursor cursor)
     : base(cursor)
 {
     mCursorTextDisplay = new TextDisplay(mCursor);
     AddWindow(mCursorTextDisplay);
     mCursorTextDisplay.X = 1;
 }
Example #9
0
        public CollapseWindow(Cursor cursor) : base(cursor)
		{
			this.HasMoveBar = true;
	//		Collapsed = false;



		}
Example #10
0
 public InfoBarWindow(Cursor cursor)
     : base(cursor)
 {
     mCursorTextDisplay = new TextDisplay(mCursor);
     AddWindow(mCursorTextDisplay);
     mCursorTextDisplay.X = 1;
     mTimeLastSave = TimeManager.CurrentTime;
 }
Example #11
0
        public FileButtonWindow(Cursor cursor)
        {
            camera = SpriteManager.Cameras[0];
            this.messages = GuiData.messages;
            sesgMan = GameData.sesgMan;

            mAssetsRelativeToSpriteRig = true;
        }
Example #12
0
        public ToolsWindow(Cursor cursor) : base()
		{
			messages = GuiData.Messages;

			SetPositionTL(3.5f, 63.8f);

            HasCloseButton = true;

            moveObject = AddToggleButton();
			moveObject.Text = "Move";
			moveObject.SetOverlayTextures(
                FlatRedBallServices.Load<Texture2D>("Content/icons/Tools/move.tga", AppState.Self.PermanentContentManager),
                null);

            attachObject = AddToggleButton();
			attachObject.Text = "Attach";
			moveObject.AddToRadioGroup(attachObject);
			attachObject.SetOverlayTextures(
                FlatRedBallServices.Load<Texture2D>("Content/icons/attach.tga", AppState.Self.PermanentContentManager),
                null);


            detachObject = AddButton();
			detachObject.Text = "Detach";
			detachObject.Enabled = false;
			detachObject.SetOverlayTextures(
                FlatRedBallServices.Load<Texture2D>("Content/icons/detach.tga", AppState.Self.PermanentContentManager),             
                null);
			detachObject.Click += new GuiMessage(messages.DetachObjectClick);


            copyEmitter = AddButton();
			copyEmitter.Text = "Copy";
			copyEmitter.SetOverlayTextures(
                FlatRedBallServices.Load<Texture2D>("Content/icons/duplicate.tga", AppState.Self.PermanentContentManager),             
                null);
			copyEmitter.Click += new GuiMessage(CopyEmitterClick);
            copyEmitter.Enabled = false ;

            scaleEmitterTime = AddButton();
			scaleEmitterTime.Text = "Scale Emitter Speed";
			scaleEmitterTime.SetOverlayTextures(15, 2);
			scaleEmitterTime.Click += new GuiMessage(ScaleEmitterTimeClick);
			scaleEmitterTime.Enabled = false;

            #region DownZFreeRotateButton

            this.mDownZFreeRotateButton = base.AddToggleButton();


            mDownZFreeRotateButton.SetOverlayTextures(
                FlatRedBallServices.Load<Texture2D>(@"Content\DownZ.png", FlatRedBallServices.GlobalContentManager),
                FlatRedBallServices.Load<Texture2D>(@"Content\FreeRotation.png", FlatRedBallServices.GlobalContentManager));


            #endregion
		}
        private bool IsCursorInWindow()
        {
            FlatRedBall.Gui.Cursor cursor = GuiManager.Cursor;
            int cursorScreenX             = cursor.ScreenX;
            int cursorScreenY             = cursor.ScreenY;

            return(cursorScreenX > 0 && cursorScreenY > 0 &&
                   cursorScreenX < mXnaControl.ActualWidth &&
                   cursorScreenY < mXnaControl.ActualHeight);
        }
Example #14
0
        public MenuStrip(Cursor cursor)
            : base(cursor)
        {
            ScaleX = GuiManager.Camera.XEdge;
            ScaleY = MenuStripHeight/2.0f;

            X = ScaleX - .01f ;
            Y = ScaleY - .01f ;

            mMenus = new List<MenuItem>();
            mMenusReadOnly = new ReadOnlyCollection<MenuItem>(mMenus);

        }
        public LocalizationWindow(Cursor cursor)
            : base(cursor)
        {
            ScaleX = 10;
            ScaleY = 2.0f;
            HasMoveBar = true;
            HasCloseButton = true;

            _currentLanguageComboBox = new ComboBox(cursor);
            AddWindow(_currentLanguageComboBox);
            _currentLanguageComboBox.ScaleX = 9.5f;

            _currentLanguageComboBox.ItemClick += OnLanguageSelection;
        }
        public AdvancedShapeCollectionLoadingWindow(Cursor cursor, MultiButtonMessageBox mbmb, TypesToLoad typesToLoad) : base(cursor)
        {
            this.AddWindow(mbmb);

            this.ScaleX = mbmb.ScaleX + 12.5f;
            mbmb.DrawBorders = false;
            mbmb.X = mbmb.ScaleX;

            mbmb.RemoveButton(mbmb.GetButton("Advanced >>"));
            // Maybe one day we want to allow the user to go back to the 
            // basic view?  It's a pain, so I won't do that now

            mbmb.Y = mbmb.ScaleY;
            this.ScaleY = mbmb.ScaleY + 1;


            //Button cancelButton = mbmb.GetButton("Cancel");
            //mbmb.RemoveButton(cancelButton);
            mbmb.HasMoveBar = false;
            mbmb.HasCloseButton = false;
            this.HasMoveBar = true;

            //mbmb.AddButton(cancelButton);

            TextDisplay textDisplay = new TextDisplay(cursor);
            textDisplay.Text = "Offset";
            this.AddWindow(textDisplay);
            textDisplay.X = mbmb.ScaleX * 2;
            textDisplay.Y = 1;

            offsetWindow = new Vector3Display(cursor);
            this.AddWindow(offsetWindow);
            offsetWindow.X = mbmb.ScaleX * 2 + offsetWindow.ScaleX ;
            offsetWindow.Y = offsetWindow.ScaleY + 2;

            mbmb.Closing += new GuiMessage(CloseThis);
            this.Name = "";

            PropertyGrid<TypesToLoad> propertyGrid = new PropertyGrid<TypesToLoad>(cursor);
            propertyGrid.ObjectDisplaying = typesToLoad;
            propertyGrid.HasMoveBar = false;
            propertyGrid.HasCloseButton = false;

            this.AddWindow(propertyGrid);
            propertyGrid.X = mbmb.ScaleX * 2 + propertyGrid.ScaleX - 1; // subtract 1 because we're not going to show the frames
            propertyGrid.Y = propertyGrid.ScaleY + 2 + offsetWindow.ScaleY * 2 + .5f;

            propertyGrid.DrawBorders = false;

        }
Example #17
0
        public MessageBox(Cursor cursor) : 
            base(cursor)
		{
            okButton = new Button(mCursor);
            AddWindow(okButton);
			this.HasMoveBar = true;
            this.HasCloseButton = true;
            Visible = false;
			textDisplay = new TextField();

			textDisplay.mAlignment = HorizontalAlignment.Left;

            
            //mTextRed = mTextGreen = mTextBlue = 20;

		}
Example #18
0
        public ChatWindow(Cursor cursor)
            : base(cursor)
		{
            mListBox = new ListBox(mCursor);
            AddWindow(mListBox);

            mTextBox = new TextBox(mCursor);
            AddWindow(mTextBox);
            mTextBox.EnterPressed += TextBoxEnter;

            Resizing += ResizeEvent;



            ScaleX = 5;
            ScaleY = 5;
        }
Example #19
0
        public InfoBar(Cursor cursor)
            : base(cursor)
        {
            ScaleX = GuiManager.Camera.XEdge;
            ScaleY = MenuStrip.MenuStripHeight / 2.0f;

            X = ScaleX - .001f;
            Y = 2 * GuiManager.Camera.YEdge - ScaleY;
            Y += .001f;

            mTextDisplay = new TextDisplay(mCursor);
            AddWindow(mTextDisplay);
            mTextDisplay.X = 1;

            mTextDisplay.Text = "";

        }
Example #20
0
        public virtual void TestCollision(FlatRedBall.Gui.Cursor cursor)
        {
            if (HasCursorOver(cursor))
            {
                cursor.WindowOver = this;

                if (cursor.PrimaryPush)
                {
                    cursor.WindowPushed = this;

                    if (Push != null)
                    {
                        Push(this);
                    }


                    cursor.GrabWindow(this);
                }

                if (cursor.PrimaryClick) // both pushing and clicking can occur in one frame because of buffered input
                {
                    if (cursor.WindowPushed == this)
                    {
                        if (Click != null)
                        {
                            Click(this);
                        }
                        if (cursor.PrimaryClickNoSlide && ClickNoSlide != null)
                        {
                            ClickNoSlide(this);
                        }

                        // if (cursor.PrimaryDoubleClick && DoubleClick != null)
                        //   DoubleClick(this);
                    }
                    else
                    {
                        if (SlideOnClick != null)
                        {
                            SlideOnClick(this);
                        }
                    }
                }
            }
        }
        public MultiButtonMessageBox(Cursor cursor) : 
            base(cursor)
		{
			buttonArray = new WindowArray();
			this.HasMoveBar = true;
			textField = new TextField();
            textField.WindowParent = this;

			textField.TextHeight = GuiManager.TextHeight;
            
			this.ScaleX = 5;

            GuiManagerDrawn = true;
//			this.ScaleY = 5;

            this.Dragging += Move;

		}
Example #22
0
        public static void Initialize()
        {
            #region initialize engine managers and data
            guiData = new GuiData();
            camera  = SpriteManager.Camera;
            cursor  = GuiManager.Cursor;

            SpriteManager.Camera.FarClipPlane = 1800;

            mEditorLogic = new EditorLogic();

            EditorProperties = new EditorProperties();

            #endregion

//            SpriteManager.AddParticleSprite(
//              FlatRedBallServices.Load<Texture2D>("redball.bmp", "PermanentContentManager"));
        }
 private void HandleGrabbedMovement(FlatRedBall.Gui.Cursor cursor)
 {
     // Don't do any movement on a push because the window could be gaining focus
     if (!cursor.PrimaryPush && mGrabbedElementRuntime != null)
     {
         if (mGrabbedElementRuntime.DirectObjectReference != null)
         {
             if (mGrabbedElementRuntime.DirectObjectReference is PositionedObject)
             {
                 PositionedObjectMover.MouseMoveObject(mGrabbedElementRuntime.DirectObjectReference as PositionedObject, MovementStyle.Hierarchy);
             }
         }
         else
         {
             PositionedObjectMover.MouseMoveObject(mGrabbedElementRuntime, MovementStyle.Hierarchy);
         }
     }
 }
Example #24
0
        public TextInputWindow(Cursor cursor) : 
            base(cursor)
		{
            mCancelButton = new Button(mCursor);
            AddWindow(mCancelButton);

            mOkButton = new Button(mCursor);
            AddWindow(mOkButton);

            mTextBox = new TextBox(mCursor);
            AddWindow(mTextBox);

			mTextBox.EnterPressed += new GuiMessage(OkButtonClick);
			this.HasMoveBar = true;
            this.HasCloseButton = true;
            Visible = false;
			mTextDisplay = new TextField();

        }
        public SESpriteGridManager()
		{
			camera = GameData.Camera;
			cursor = GameData.Cursor;
			currentSprites = GameData.EditorLogic.CurrentSprites;

			messages = GuiData.messages;

            mSpriteGridBorder = new SpriteGridBorder(cursor,
                camera);

            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "XLeftBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "XRightBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "YTopBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "YBottomBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "ZCloseBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "ZFarBound", RepopulateSpriteGrid);

            tla = new List<TextureLocation<Texture2D>>();
        }
        public void Activity()
        {
            FlatRedBall.Gui.Cursor cursor         = GuiManager.Cursor;
            ElementRuntime         elementRuntime = ArrowState.Self.CurrentContainedElementRuntime;

            mCameraController.Activity();

            TryHandleCursorPush(cursor);

            HandleGrabbedMovement(cursor);

            if (cursor.PrimaryClick)
            {
                if (IsCursorInWindow())
                {
                    RecordChanges();
                    PropertyGridManager.Self.UpdateToSelectedInstance();
                }
                mGrabbedElementRuntime = null;
            }
        }
Example #27
0
        public EditAndSetButtons(Cursor cursor) : base(cursor)
        {
            ScaleY = 1.6f;
            ScaleX = 5.7f;

            mEditButton = new Button(mCursor);
            this.AddWindow(mEditButton);
            mEditButton.ScaleX = 2.5f;
            mEditButton.X = 3f;
            mEditButton.Text = "Edit";
            mEditButton.Click += OnEditButtonClick;



            mSetButton =  new Button(mCursor);
            this.AddWindow(mSetButton);
            mSetButton.ScaleX = 2.5f;
            mSetButton.X = 2*ScaleX - 3f;
            mSetButton.Text = "Set"; 
            mSetButton.Click += OnSetButtonClick;
        }
        public TimeControlButtonWindow(Cursor cursor) : base(cursor)
        {
			//GuiManager.AddWindow(this);

			SetPositionTL(5.2f, 40);
			ScaleX = 5.2f;
			ScaleY = 1.95f;
			mName = "Time Controls";
			mMoveBar = true;


            toStartButton = new Button(mCursor);
            AddWindow(toStartButton);
			toStartButton.SetPositionTL(1.9f, 1.9f);
			toStartButton.ScaleX = 1.5f;
			toStartButton.ScaleY = 1.5f;
			toStartButton.SetOverlayTextures(10, 1);
			toStartButton.Click += new GuiMessage(toStartButtonClick);
            toStartButton.Text = "To Start";


            stopButton = new Button(mCursor);
            AddWindow(stopButton);
			stopButton.SetPositionTL(5.1f, 1.9f);
			stopButton.ScaleX = 1.5f;
			stopButton.ScaleY = 1.5f;
			stopButton.SetOverlayTextures(11, 1);
			stopButton.Click += new GuiMessage(stopButtonClick);
            stopButton.Text = "Stop";

            playButton = new ToggleButton(mCursor);
            AddWindow(playButton);
			playButton.SetPositionTL(8.3f, 1.9f);
			playButton.ScaleX = 1.5f;
			playButton.ScaleY = 1.5f;
			playButton.SetOverlayTextures(9, 1);
			playButton.Click += new GuiMessage(playButtonClick);
            playButton.Text = "Play";

        }
Example #29
0
        public Vector3OkWindow(Cursor cursor)
            : base(cursor)
        {
            this.ScaleX = 6.5f;
            this.ScaleY = 6.0f;
            HasMoveBar = true;
            HasCloseButton = true;

            mVector3Display = new Vector3Display(cursor);
            this.AddWindow(mVector3Display);
            mVector3Display.Y = .5f + mVector3Display.ScaleY;

            this.Closing += GuiManager.RemoveWindow;

            Button okButton = new Button(mCursor);
            AddWindow(okButton);
            const float border = .5f;
            okButton.Y = this.ScaleY * 2 - okButton.ScaleY - border;
            okButton.ScaleX = 3;
            okButton.Text = "Ok";
            okButton.Click += ShiftSceneOk;
        }
        private bool TryHandleCursorPush(FlatRedBall.Gui.Cursor cursor)
        {
            bool didHandle = false;

            if (cursor.PrimaryPush && cursor.IsInWindow() && mXnaControl.IsPanelFocused)
            {
                var before = mGrabbedElementRuntime;
                mGrabbedElementRuntime = GetElementRuntimeOver(cursor);
                didHandle = true;
                if (before != mGrabbedElementRuntime)
                {
                    ArrowState.Self.CurrentContainedElementRuntime = mGrabbedElementRuntime;
                    // Need to do something here to allow selection to occur
                    //ArrowState.Self.CurrentContainedElementRuntime = mGrabbedElementRuntime;
                }
                else if (mGrabbedElementRuntime == null)
                {
                    ArrowState.Self.CurrentContainedElementRuntime = null;
                }
            }
            return(didHandle);
        }
        public void TestCollision(Cursor cursor)
        {
            if (HasCursorOver(cursor))
            {
                cursor.WindowOver = this;

                if (cursor.PrimaryPush)
                {

                    cursor.WindowPushed = this;

                    if (Push != null)
                        Push(this);

                    cursor.GrabWindow(this);

                }

                if (cursor.PrimaryClick) // both pushing and clicking can occur in one frame because of buffered input
                {
                    if (cursor.WindowPushed == this)
                    {
                        if (Click != null)
                        {
                            Click(this);
                        }
                        if (cursor.PrimaryClickNoSlide && ClickNoSlide != null)
                        {
                            ClickNoSlide(this);
                        }

                        // if (cursor.PrimaryDoubleClick && DoubleClick != null)
                        //   DoubleClick(this);
                    }
                    else
                    {
                        if (SlideOnClick != null)
                        {
                            SlideOnClick(this);
                        }
                    }
                }
            }
        }
Example #32
0
        public override void TestCollision(Cursor cursor)
		{
			if(!mCollapsed)
			{
				base.TestCollision(cursor);


				if(cursor.WindowOver == this && cursor.PrimaryDoubleClick &&
                    cursor.YForUI > mWorldUnitY + mScaleY - 2.1f)
				{
					DoubleClickCollapse();
				}
			}
			else
			{
                if (cursor.YForUI > mWorldUnitY + mScaleY - 2.1f)
				{ 
					if(cursor.PrimaryPush)
					{// drag the window
						cursor.WindowPushed = this;
						cursor.GrabWindow(this);
					}
					if(cursor.PrimaryDoubleClick)
					{
						DoubleClickCollapse();
					}
				}
			}
		}
Example #33
0
 public bool IsMouseOver(Cursor cursor, Layer layer)
 {
     return cursor.IsOn3D(this, layer);
 }
Example #34
0
 bool IMouseOver.IsMouseOver(Cursor cursor)
 {
     return cursor.IsOn3D(this);
 }
 public override bool WasClickedThisFrame(FlatRedBall.Gui.Cursor cursor)
 {
     return(cursor.PrimaryClick && HasCursorOver(cursor));
 }
Example #36
0
        public override void TestCollision(Cursor cursor)
		{
			base.TestCollision(cursor);
			if(cursor.PrimaryClick)
			{
				if(cursor.WindowOver == okButton)
				{
					if(OkClick != null)
						OkClick(this);

                    Visible = false;
					cursor.WindowClosing = this;
					
				}
			}
		}
Example #37
0
        public override void TestCollision(Cursor cursor)
        {
            base.TestCollision(cursor);

            #region Make sure that we're not highlighting items that don't exist

            for (int i = mHighlightedItems.Count - 1; i > -1; i--)
            {
                if (!Contains(mHighlightedItems[i]))
                {
                    mHighlightedItems.RemoveAt(i);
                }
            }

            #endregion

            #region Highlight item at cursor if HiglightOnRollOver
            if (HighlightOnRollOver && (cursor.XVelocity != 0 || cursor.YVelocity != 0) &&
                cursor.WindowOver == this)
            {
                HighlightItemAtCursor(this);
            }
            #endregion

            #region Show the tool tip if CurrentToolTipOption is CursorOver
            if (CurrentToolTipOption == ToolTipOption.CursorOver &&
                !mCursor.IsOn((IWindow)mScrollBar))
            {
                CollapseItem itemOver = GetItemAtCursor();
                if (itemOver != null)
                {
                    GuiManager.ToolTipText = itemOver.Text;
                }
            }
            #endregion

            #region Move the scroll bar if the mouse wheel is moving
            if (cursor.ZVelocity != 0 && mScrollBar != null)
            {
                if (cursor.ZVelocity > 0)
                    mScrollBar.upButton.OnClick();
                else
                    mScrollBar.downButton.OnClick();
            }
            #endregion

            #region If the user's grabbed and dropped a CollapseItem, raise the event

            if (mCursor.PrimaryClick && GuiManager.CollapseItemDraggedOff != null &&
                GuiManager.CollapseItemDraggedOff.parentBox != this)
            {
                if (this.CollapseItemDropped != null)
                {
                    this.CollapseItemDropped(this);
                }
            }

            #endregion

            #region Regulate the mStartAt property according to the number of elements in the list

            int numOfCollapsedItems = GetNumCollapsed();
            if (mStartAt + NumberOfVisibleElements > numOfCollapsedItems) mStartAt = numOfCollapsedItems - NumberOfVisibleElements;
            if (mStartAt < 0) mStartAt = 0;

            #endregion

            SetInsertLocationIndex();

        }
        public bool HasCursorOver(Cursor cursor)
        {
            if (((IWindow)this).AbsoluteVisible)
            {
                int screenX = cursor.ScreenX;
                int screenY = cursor.ScreenY;

                float worldX;
                float worldY;

                this.Managers.Renderer.Camera.ScreenToWorld(
                    screenX, screenY,
                    out worldX, out worldY);

                // for now we'll just rely on the bounds of the GUE itself

                return global::RenderingLibrary.IPositionedSizedObjectExtensionMethods.HasCursorOver(
                    this, worldX, worldY);
            }
            else
            {
                return false;
            }
        }
        // Methods
        public SpriteRigSaveOptions(GuiMessages messages, Cursor cursor)
            : base(cursor)
        {
            this.messages = messages;
            GuiManager.AddWindow(this);
            this.ScaleX = 13f;
            this.ScaleY = 17f;
            base.HasMoveBar = true;
            base.mName = "SpriteRig Options";
            base.HasCloseButton = true;

            TextDisplay tempTextDisplay = new TextDisplay(mCursor);
            AddWindow(tempTextDisplay);
            tempTextDisplay.Text = "Include:";
            tempTextDisplay.SetPositionTL(0.2f, 1.5f);

            this.sceneOrGroup = new ComboBox(mCursor);
            AddWindow(sceneOrGroup);
            this.sceneOrGroup.ScaleX = 8f;
            this.sceneOrGroup.SetPositionTL(10f, 3.5f);
            this.sceneOrGroup.Text = "Entire Scene";
            this.sceneOrGroup.AddItem("Current Group");
            this.sceneOrGroup.AddItem("Entire Scene");

            tempTextDisplay = new TextDisplay(mCursor);
            AddWindow(tempTextDisplay);
            tempTextDisplay.Text = "Body Sprite Selection Includes:";
            tempTextDisplay.SetPositionTL(0.2f, 6f);

            this.bodySpriteSelectionMethod = new ComboBox(mCursor);
            AddWindow(bodySpriteSelectionMethod);
            this.bodySpriteSelectionMethod.ScaleX = 8f;
            this.bodySpriteSelectionMethod.SetPositionTL(10f, 8.5f);
            this.bodySpriteSelectionMethod.Text = "Name Includes";
            this.bodySpriteSelectionMethod.AddItem("Name Includes");
            this.bodySpriteSelectionMethod.AddItem("By Texture");
            this.bodySpriteSelectionMethod.AddItem("All Not Joint");
            this.bodySpriteSelectionMethod.AddItem("All");
            this.bodySpriteSelectionMethod.ItemClick += new GuiMessage(this.bodySpriteSelectionMethodClicked);

            this.bodyAvailableTextures = new ComboBox(mCursor);
            AddWindow(bodyAvailableTextures);
            this.bodyAvailableTextures.ScaleX = 8f;
            this.bodyAvailableTextures.SetPositionTL(10f, 10.5f);
            this.bodyAvailableTextures.Visible = false;

            this.bodyNameToInclude = new TextBox(mCursor);
            AddWindow(bodyNameToInclude);
            this.bodyNameToInclude.ScaleX = 8f;
            this.bodyNameToInclude.SetPositionTL(10f, 10.5f);

            tempTextDisplay = new TextDisplay(mCursor);
            AddWindow(tempTextDisplay);
            tempTextDisplay.Text = "Joint Sprite Selection Includes:";
            tempTextDisplay.SetPositionTL(0.2f, 13f);

            this.jointSpriteSelectionMethod = new ComboBox(mCursor);
            AddWindow(jointSpriteSelectionMethod);
            this.jointSpriteSelectionMethod.ScaleX = 8f;
            this.jointSpriteSelectionMethod.SetPositionTL(10f, 15.5f);
            this.jointSpriteSelectionMethod.Text = "Name Includes";
            this.jointSpriteSelectionMethod.AddItem("Name Includes");
            this.jointSpriteSelectionMethod.AddItem("By Texture");
            this.jointSpriteSelectionMethod.AddItem("All Not Body");
            this.jointSpriteSelectionMethod.AddItem("All");
            this.jointSpriteSelectionMethod.ItemClick += new GuiMessage(this.jointSpriteSelectionMethodClicked);

            this.jointAvailableTextures = new ComboBox(mCursor);
            AddWindow(jointAvailableTextures);
            this.jointAvailableTextures.ScaleX = 8f;
            this.jointAvailableTextures.SetPositionTL(10f, 18f);
            this.jointAvailableTextures.Visible = false;

            this.jointNameToInclude = new TextBox(mCursor);
            AddWindow(jointNameToInclude);
            this.jointNameToInclude.ScaleX = 8f;
            this.jointNameToInclude.SetPositionTL(10f, 18f);

            tempTextDisplay = new TextDisplay(mCursor);
            AddWindow(tempTextDisplay);
            tempTextDisplay.Text = "Root Sprite:";
            tempTextDisplay.SetPositionTL(0.2f, 20);

            this.rootSpriteComboBox = new ComboBox(mCursor);
            AddWindow(rootSpriteComboBox);
            this.rootSpriteComboBox.ScaleX = 8f;
            this.rootSpriteComboBox.SetPositionTL(10f, 22.5f);
            this.rootSpriteComboBox.Text = "<No Root>";

            tempTextDisplay = new TextDisplay(mCursor);
            AddWindow(tempTextDisplay);
            tempTextDisplay.Text = "Sprite Visibility:";
            tempTextDisplay.SetPositionTL(0.2f, 25f);

            this.jointsVisible = new ToggleButton(mCursor);
            AddWindow(jointsVisible);
            this.jointsVisible.SetPositionTL(11f, 27f);
            this.jointsVisible.SetText("Joints Not Visible", "Joints Visible");
            this.jointsVisible.ScaleX = 7.5f;

            this.rootVisible = new ToggleButton(mCursor);
            AddWindow(rootVisible);
            this.rootVisible.SetPositionTL(11f, 29f);
            this.rootVisible.SetText("Root Not Visible", "Root Visible");
            this.rootVisible.ScaleX = 7.5f;

            this.okButton = new Button(mCursor);
            AddWindow(okButton);
            this.okButton.Text = "Save";
            this.okButton.ScaleX = 4.5f;
            this.okButton.ScaleY = 1.3f;
            this.okButton.SetPositionTL(5f, 32f);
            this.okButton.Click += new GuiMessage(this.saveButtonClick);

            this.cancelButton = new Button(mCursor);
            AddWindow(cancelButton);
            this.cancelButton.Text = "Cancel";
            this.cancelButton.ScaleX = 4.5f;
            this.cancelButton.ScaleY = 1.3f;
            this.cancelButton.SetPositionTL(16f, 32f);
            this.cancelButton.Click += new GuiMessage(this.cancelButtonClick);

            this.Visible = false;
        }
Example #40
0
        public ListBoxBase(GuiSkin guiSkin, Cursor cursor)
            : base(guiSkin, cursor)
        {
            mTexts = new PositionedObjectList<Text>();
            mHighlight = new Sprite();
            mHighlight.Z = AbsoluteWorldUnitZ - .0001f *
                FlatRedBall.Math.MathFunctions.ForwardVector3.Z;
            mScrollBar = new ScrollBar(guiSkin, cursor);
            AddWindow(mScrollBar);
            Initialize();
            mScrollBar.SpriteFrame.RelativeZ = -.01f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;


            // Even though the base constructor calls SetSkin, the mTexts are not
            // created yet so their font is never set.  This set the fonts once again.

            mHighlightBar = new SpriteFrame(
                guiSkin.WindowSkin.Texture, guiSkin.WindowSkin.BorderSides);
            SpriteManager.AddSpriteFrame(mHighlightBar);
            mHighlightBar.AttachTo(SpriteFrame, false);
            mHighlightBar.RelativeZ = -HighlightBarOffset * Math.MathFunctions.ForwardVector3.Z;
            mHighlightBar.Visible = false;

            SetSkin(guiSkin);
        }
Example #41
0
        public ListBoxBase(Cursor cursor)
            : base(cursor)
        {
            mHighlight = new Sprite();
            mHighlight.Z = AbsoluteWorldUnitZ - .0001f *
                FlatRedBall.Math.MathFunctions.ForwardVector3.Z;
            mScrollBar = new ScrollBar(mCursor);
            AddWindow(mScrollBar);

            Initialize();

        }