public AUI_Slider_Horizontal(int X, int Y)
        {
            bkgLineWindow = new AUI_Window(X, Y, Width, 4);
            bkgLineWindow.rec_bkg.color  = Assets.ForegroundColor;
            bkgLineWindow.rec_fore.color = Assets.BackgroundColor;

            text = new AUI_Text("0.15",
                                X + 16 * 9 + 6, Y - 10, Assets.ForegroundColor);
            text.color = Assets.ForegroundColor;
            text.font  = Assets.font;

            //this is what user clicks left/right of
            handle = new Int4(X, Y - 6, 4, 16);
            //this is what controls the clickable area
            hitbox = new Int4(X, Y - 10, Width, 24);
            //this gives user feedback they clicked somewhere
            clickLine = new Int4(X, Y - 3, 1, 10);

            //inits slider to start 0
            clickX = X + 4;
            //inits slider to end 1.0 max
            //clickX = X + Width - 8;

            displayState = DisplayState.Closed;
        }
Example #2
0
 public void SetClosedRec(Int4 Rec)
 {
     rec_bkg.closedRec    = Rec;
     rec_fore.closedRec.X = rec_bkg.closedRec.X + 1;
     rec_fore.closedRec.Y = rec_bkg.closedRec.Y + 1;
     rec_fore.closedRec.W = rec_bkg.closedRec.W - 2;
     rec_fore.closedRec.H = rec_bkg.closedRec.H - 2;
 }
Example #3
0
 public void SetOpenedRec(Int4 Rec)
 {
     rec_bkg.openedRec    = Rec;
     rec_fore.openedRec.X = rec_bkg.openedRec.X + 1;
     rec_fore.openedRec.Y = rec_bkg.openedRec.Y + 1;
     rec_fore.openedRec.W = rec_bkg.openedRec.W - 2;
     rec_fore.openedRec.H = rec_bkg.openedRec.H - 2;
 }
Example #4
0
 public static void DrawInt4(SpriteBatch SB, Int4 int4, Color color, float alpha)
 {   //match draw rec to int4
     DrawRec.X = int4.X;
     DrawRec.Y = int4.Y;
     DrawRec.Width = int4.W;
     DrawRec.Height = int4.H;
     //draw with draw rec at color at alpha
     SB.Draw(Assets.recTex, DrawRec, color * alpha);
 }
Example #5
0
 private void Snap(Int4 targetRec, int speed)
 {   //snap if we get close enough
     if (Math.Abs(drawRec.X - targetRec.X) <= speed)
     {
         drawRec.X = targetRec.X;
     }
     if (Math.Abs(drawRec.Y - targetRec.Y) <= speed)
     {
         drawRec.Y = targetRec.Y;
     }
     if (Math.Abs(drawRec.Width - targetRec.W) <= speed)
     {
         drawRec.Width = targetRec.W;
     }
     if (Math.Abs(drawRec.Height - targetRec.H) <= speed)
     {
         drawRec.Height = targetRec.H;
     }
 }
Example #6
0
        Rectangle texRec         = new Rectangle(0, 0, 1, 1); //tex rec


        public AUI_Rectangle(int X, int Y, int W, int H, RecAnimType Type)
        {
            animType  = Type;
            openedRec = new Int4(X, Y, W, H);

            if (animType == RecAnimType.WipeRight)
            {   //setup wipe right anim targets
                openingRec = new Int4(X, Y, 0, H);
                closedRec  = new Int4(X + W, Y, 0, H);
            }
            else if (animType == RecAnimType.WipeLeft)
            {   //setup wipe left anim targets
                openingRec = new Int4(X + W, Y, 0, H);
                closedRec  = new Int4(X, Y, 0, H);
            }

            //set draw to closed rec values
            drawRec.X     = closedRec.X; drawRec.Y = closedRec.Y;
            drawRec.Width = closedRec.W; drawRec.Height = closedRec.H;
        }
Example #7
0
 public static Boolean Contains(Int4 int4, float x, float y)
 {
     return ((((int4.X <= x) && (x < (int4.X + int4.W)))
         && (int4.Y <= y)) && (y < (int4.Y + int4.H)));
 }