Esempio n. 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);
 }
        void Update()
        {
            _easy.Clear(Color.Transparent);
            _easy.Fill(_bgColor);
            _easy.Stroke(_borderColor);
            _easy.StrokeWeight(_borderWeight);
            _easy.ShapeAlign(CenterMode.Min, CenterMode.Min);
            _easy.Rect(0, 0, _easy.width - _borderWeight, _easy.height - _borderWeight);

            _easy.Fill(_textColor);
            _easy.TextAlign(CenterMode.Min, CenterMode.Min);
            _easy.Text(_textToShow, _paddingX, _paddingY);

            if (_pressAnyKeyMsg != null)
            {
                _pressAnyKeyMsg.visible = _showPressAnyKeyToNext;
            }
        }
    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);
        }
    }