/// <summary>
        /// 
        /// </summary>
        /// <param name="size"></param>
        /// <param name="position"></param>
        /// <param name="count"></param>
        public GuiScrollable(Vector2 size, Vector2 position, int count)
            : base(string.Empty, size, position)
        {
            _count = count;

            Vector2 scrollSize = new Vector2(size.X * 0.9f, size.Y / _count);
            _scrollButton = new GuiButton("scroll",
                scrollSize,
                new Vector2(
                    position.X + ((size.X * 0.1f) / 2),
                    position.Y
                )
            );

            GraceArea = new Rectangle((int)position.X - 25, (int)position.Y, (int)size.X + 50, (int)size.Y);

            Color = new Color(0, 153, 153);
        }
Beispiel #2
0
        public GuiScrollable(Vector2 size, Vector2 position, int count)
            : base(string.Empty, size, position)
        {
            _count = count;

            Vector2 scrollSize = new Vector2(size.X * 0.9f, size.Y / _count);

            _scrollButton = new GuiButton("scroll",
                                          scrollSize,
                                          new Vector2(
                                              position.X + ((size.X * 0.1f) / 2),
                                              position.Y
                                              )
                                          );

            GraceArea = new Rectangle((int)position.X - 25, (int)position.Y, (int)size.X + 50, (int)size.Y);

            Color = new Color(0, 153, 153);
        }
        public void FourthTest()
        {
            gui = new GuiButton("UpdateQueue", new Vector2(500, 500), Vector2.Zero);
            gui.ClickEvent += clickedOn;
            gui.LoadContent(game, contentManager, spriteBatch);

            MouseState currentMouseState = new MouseState(
                    50,
                    50,
                    0,
                    ButtonState.Released,
                    ButtonState.Released,
                    ButtonState.Released,
                    ButtonState.Released,
                    ButtonState.Released
                );

            MouseState oldMouseState = new MouseState(
                    currentMouseState.X,
                    currentMouseState.Y,
                    currentMouseState.ScrollWheelValue,
                    ButtonState.Pressed,
                    currentMouseState.MiddleButton,
                    currentMouseState.RightButton,
                    currentMouseState.XButton1,
                    currentMouseState.XButton2
                );

            Assert.IsNotNull(currentMouseState);
            Assert.IsNotNull(oldMouseState);
            Assert.IsFalse(gui.Hovered);

            GameTime gt = new GameTime(new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 0, 0, 100));
            Assert.IsFalse(isClickedOn);

            gui.Update(currentMouseState, oldMouseState, new Rectangle(currentMouseState.X, currentMouseState.Y, 1, 1), gt);

            Assert.IsTrue(gui.Hovered);
            Assert.IsTrue(isClickedOn);

            gui.ClickEvent -= clickedOn;
        }
Beispiel #4
0
        public override void LoadContent(Game game, ContentManager contentManager, SpriteBatch spriteBatch)
        {
            Texture2D = contentManager.Load <Texture2D>(@"blank");
            if (string.IsNullOrEmpty(_textureName))
            {
                _scrollButton.Texture2D = contentManager.Load <Texture2D>(@"blank");
            }
            else
            {
                Texture2D scrollTexture = contentManager.Load <Texture2D>(_textureName);
                Vector2   scrollSize    = new Vector2(scrollTexture.Width, scrollTexture.Height);
                _scrollButton = new GuiButton("scroll",
                                              scrollSize,
                                              new Vector2(
                                                  Position.X - (scrollSize.X / 2),
                                                  Position.Y
                                                  )
                                              );

                _scrollButton.Texture2D = scrollTexture;
            }
        }
        public override void LoadContent(Game game, ContentManager contentManager, SpriteBatch spriteBatch)
        {
            Texture2D = contentManager.Load<Texture2D>(@"blank");
            if (string.IsNullOrEmpty(_textureName))
            {
                _scrollButton.Texture2D = contentManager.Load<Texture2D>(@"blank");
            }
            else
            {
                Texture2D scrollTexture = contentManager.Load<Texture2D>(_textureName);
                Vector2 scrollSize = new Vector2(scrollTexture.Width, scrollTexture.Height);
                _scrollButton = new GuiButton("scroll",
                    scrollSize,
                    new Vector2(
                        Position.X - (scrollSize.X / 2),
                        Position.Y
                    )
                );

                _scrollButton.Texture2D = scrollTexture;
            }
        }