Exemple #1
0
        public void Update()
        {
            if (Pressed())
            {
                Current = buttonDown;
            }
            else
            {
                Current = buttonUp;
            }

            Current.Update();
        }
Exemple #2
0
        public ButtonAnimation(int X, int Y, int Width, int Height, Func <bool> Pressed)
        {
            this.X       = X;
            this.Y       = Y;
            this.Width   = Width;
            this.Height  = Height;
            this.Pressed = Pressed;

            var offsetX = (Width / 100) * 5;
            var offsetY = (Height / 100) * 5;

            var z = 0.8f;

            buttonUp = GeneratedContent.Create_touch_inputs_button(-offsetX, -offsetY, z, Width + offsetX, Height + offsetY);
            buttonUp.ChangeColor(new Color(253, 205, 1));
            buttonDown = GeneratedContent.Create_touch_inputs_button_pressed(0, 0, z, Width, Height);
            buttonDown.ChangeColor(new Color(253, 205, 1));

            Current = buttonUp;
        }