Example #1
0
        public static float doVerticalScrollBar(int id, int xPos, int yPos, int drawWidth, int drawHeight,
                                                int contentHeight, float scroll)
        {
            if (drawHeight > contentHeight)
            {
                contentHeight = drawHeight;
            }
            var destinationRectangle = new Rectangle(xPos, yPos, drawWidth, drawHeight);

            if (destinationRectangle.Contains(GuiData.getMousePoint()) || GuiData.active == id)
            {
                GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Gray * 0.1f);
            }
            var   num1 = scroll;
            float num2 = contentHeight - drawHeight;
            var   num3 = drawHeight / (float)contentHeight * drawHeight;
            var   num4 = scroll / num2 * (drawHeight - num3);
            var   num5 =
                DraggableRectangle.doDraggableRectangle(id, xPos, yPos + num4, drawWidth, (int)num3, drawWidth,
                                                        Color.White, Color.Gray, true, false, xPos, yPos + drawHeight - num3, xPos, yPos).Y;

            if (Math.Abs(num5) > 0.100000001490116)
            {
                num1 = (float)((num4 + (double)num5) / (drawHeight - (double)num3)) * num2;
            }
            return(num1);
        }
Example #2
0
        public static float doVerticalScrollBar(int id, int xPos, int yPos, int drawWidth, int drawHeight, int contentHeight, float scroll)
        {
            if (drawHeight > contentHeight)
            {
                contentHeight = drawHeight;
            }
            Rectangle destinationRectangle = new Rectangle(xPos, yPos, drawWidth, drawHeight);

            if (ScrollBar.AlwaysDrawUnderBar || destinationRectangle.Contains(GuiData.getMousePoint()) || GuiData.active == id)
            {
                GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Gray * 0.1f);
            }
            float num1 = scroll;
            float num2 = (float)(contentHeight - drawHeight);
            float num3 = (float)drawHeight / (float)contentHeight * (float)drawHeight;
            float num4 = scroll / num2 * ((float)drawHeight - num3);
            float y    = DraggableRectangle.doDraggableRectangle(id, (float)xPos, (float)yPos + num4, drawWidth, (int)num3, (float)drawWidth, new Color?(Color.White), new Color?(Color.Gray), true, false, (float)xPos, (float)(yPos + drawHeight) - num3, (float)xPos, (float)yPos).Y;

            if ((double)Math.Abs(y) > 0.100000001490116)
            {
                num1 = (float)(((double)num4 + (double)y) / ((double)drawHeight - (double)num3)) * num2;
            }
            return(num1);
        }
Example #3
0
 public static Vector2 doDraggableRectangle(int myID, float x, float y, int width, int height, float selectableBorder, Color?selectedColor, Color?deselectedColor)
 {
     return(DraggableRectangle.doDraggableRectangle(myID, x, y, width, height, selectableBorder, selectedColor, deselectedColor, true, true, float.MaxValue, float.MaxValue, float.MinValue, float.MinValue));
 }
Example #4
0
 public static Vector2 doDraggableRectangle(int myID, float x, float y, int width, int height)
 {
     return(DraggableRectangle.doDraggableRectangle(myID, x, y, width, height, -1f, new Color?(), new Color?()));
 }