Example #1
0
        public override void Update(Universe universe, Vector2 origin, AvatarController avatar, List <ScanCode> input, bool ctrl, bool shift, IReadOnlyList <InterfaceLogicalButton> inputPressed,
                                    Vector2 mouseLocation, bool click, bool clickHold)
        {
            if (!Window.CallUpdates && !Window.Visible)
            {
                return;
            }

            var location = Helpers.VectorLocation(origin,
                                                  new Vector2(origin.X + _colorWheel.Width, origin.Y + _colorWheel.Height),
                                                  mouseLocation);

            if (location.X == -1 || location.Y == -1)
            {
                return;
            }

            Color color;

            try {
                color = Helpers.GetColorByCoordinate(_colorWheel.GetTexture(null), location);
            } catch {
                return;
            }

            if (color == Color.Transparent)
            {
                return;
            }

            ColorHover?.Invoke(color);

            if (click || clickHold)
            {
                ColorClick?.Invoke(color);
            }
        }
Example #2
0
 void ColorPickup_MouseMove(object sender, MouseEventArgs e)
 {
     ColorHover?.Invoke(GetColor(new Point(e.X, e.Y)));
 }