Пример #1
0
        public Slider(GraphicsDevice device,
                      ScrollList s,
                      int xPositionInPercent,
                      int yPositionInPercent,
                      int widthInPercent,
                      int heightInPercent,
                      Texture2D texture,
                      Texture2D textureSliderPloint,
                      int rangeStart, int rangeEnd, float rangeValue)
        {
            mGraphicsDevice          = device;
            mRelativePosition.X      = xPositionInPercent;
            mRelativePosition.Y      = yPositionInPercent;
            mRelativePosition.Width  = widthInPercent;
            mRelativePosition.Height = heightInPercent;

            mEvents        = new List <Event>();
            mChangeActions = new List <Action <float> >();

            mTexture             = texture;
            mTextureSliderPloint = textureSliderPloint;

            mIsVisible = true;

            mRangeStart = rangeStart;
            mRangeEnd   = rangeEnd;

            AddTo(s);

            SetValue(rangeValue);
        }
Пример #2
0
        public void AddTo(ScrollList s)
        {
            if (s.Contains(this))
            {
                return;
            }
            // Adjust position
            mSize.X      = s.mSize.Width * mRelativePosition.X / 100 + s.mSize.X;
            mSize.Y      = s.mSize.Height * mRelativePosition.Y / 100 + s.mSize.Y;
            mSize.Width  = s.mSize.Width * mRelativePosition.Width / 100;
            mSize.Height = s.mSize.Height * mRelativePosition.Height / 100;

            mParentMenu = s.ChildMenu;
            s.AddIDrawable2D(this);
        }