示例#1
0
        public override void Update(float delta)
        {
            Size = new Vector2(BoxOffset + BoxSize + BoxOffset + Font.Measure(Text).Width, BoxSize);

            var mouseOverlapping =
                ChromaExtensions.MouseOverlapping(Mouse.GetPosition(),
                                                  CalculatedPosition + new Vector2(BoxOffset), new Vector2(BoxSize));

            if (GetMouseUp(MouseButton.Left) && mouseOverlapping)
            {
                Checked = !Checked;
                OnCheckChanged(EventArgs.Empty);
            }

            HoldingBox = Mouse.IsButtonDown(MouseButton.Left) && mouseOverlapping;
            base.Update(delta);
        }
示例#2
0
        public override void Update(float delta)
        {
            var mouseOverlapping =
                ChromaExtensions.MouseOverlapping(Mouse.GetPosition(), CalculatedPosition, CalculatedSize);

            if (GetMouseUp(MouseButton.Left) && mouseOverlapping)
            {
                OnButtonPressed(EventArgs.Empty);
            }
            if (GetMouseDown(MouseButton.Left) && mouseOverlapping)
            {
                OnButtonDown(EventArgs.Empty);
            }

            HoldingButton = Mouse.IsButtonDown(MouseButton.Left) && mouseOverlapping;
            base.Update(delta);
        }
示例#3
0
        public override void Update(float delta)
        {
            var mouseOverlapping =
                ChromaExtensions.MouseOverlapping(Mouse.GetPosition(), CalculatedPosition, CalculatedSize);

            if (GetMouseUp(MouseButton.Left) && mouseOverlapping)
            {
                Focus();
            }
            else if (GetMouseUp(MouseButton.Left) && !mouseOverlapping)
            {
                DeFocus();
            }

            caret.Update(delta);

            caret.Position = new Vector2(
                caretStartPosition.X + Font.Measure(Text.Substring(0, caret.TextPosition)).Width,
                caretStartPosition.Y);
            base.Update(delta);
        }