예제 #1
0
    public override void _Ready()
    {
        InitVignette();

        var btHolder = new VBoxContainer()
        {
            MarginTop = 20, RectMinSize = GetViewportRect().Size
        };

        AddChild(btHolder);

        Button openObjBt = new Button();

        openObjBt.Text = "Open Image";
        openObjBt.Connect("pressed", this, nameof(OnOpenButton));
        openObjBt.SizeFlagsHorizontal = (int)Control.SizeFlags.ShrinkCenter;
        openObjBt.RectMinSize         = new Vector2(btHolder.RectMinSize.x * 0.7f, 40);
        openObjBt.AddFontOverride("font", new DynamicFont()
        {
            FontData = GD.Load <DynamicFontData>("res://assets/default/Tuffy_Bold.ttf"), Size = 30
        });
        btHolder.AddChild(openObjBt);

        filePopup.Connect("file_selected", this, nameof(OnFileSelected));
        AddChild(filePopup);

        imageSprite = new Sprite();
        AddChild(imageSprite);

        var labHolder = new VBoxContainer()
        {
            Alignment = BoxContainer.AlignMode.Center
        };

        AddChild(errorDiag);
        errorDiag.AddChild(labHolder);
        labHolder.AddChild(errorLabel);
    }