Example #1
0
 public ColBox(int x, int y, int width, int height, bool addCollider = true, bool showBounds = false, string name = "wall")
 {
     if (addCollider == false)
     {
         return;
     }
     col      = new EasyDraw(width, height, addCollider);
     col.name = name;
     col.NoFill();
     col.Stroke(245, 66, 66);
     if (name == "WinBox")
     {
         col.Stroke(19, 252, 3);
     }
     if (showBounds)
     {
         col.StrokeWeight(1);
     }
     else
     {
         col.NoStroke();
     }
     col.ShapeAlign(CenterMode.Min, CenterMode.Min);
     col.Rect(0, 0, col.width - 1, col.height - 1);
     col.x = x;
     col.y = y;
     AddChild(col);
 }
    private void selection()
    {
        _selection.Clear(Color.Transparent);
        _selection.NoFill();
        _selection.Stroke(_rainbow);
        _selection.StrokeWeight(5);
        _selection.ShapeAlign(CenterMode.Min, CenterMode.Min);
        _selection.Rect(0, 0, width + _selectionStrokeWidth / 2, height + _selectionStrokeWidth / 2);

        if (_hover)
        {
            float scaleDelta = _sizeOnHover - 1;
            float newScale   = 1 - scaleDelta;

            _selection.scale = newScale;
            _selection.SetXY(-_selectionStrokeWidth, -_selectionStrokeWidth);
        }
        else
        {
            _selection.scale = 1.0f;
            _selection.SetXY(-_selectionStrokeWidth / 2, -_selectionStrokeWidth / 2);
        }
    }