Exemple #1
0
        void PrepCanvas()
        {
            _skin = Skin.CreateDefaultSkin();

            // modify some of the default styles to better suit our needs
            var tfs = _skin.Get <TextFieldStyle>();

            tfs.Background.LeftWidth    = tfs.Background.RightWidth = 4;
            tfs.Background.BottomHeight = 0;
            tfs.Background.TopHeight    = 3;

            var checkbox = _skin.Get <CheckBoxStyle>();

            checkbox.CheckboxOn.MinWidth   = checkbox.CheckboxOn.MinHeight = 15;
            checkbox.CheckboxOff.MinWidth  = checkbox.CheckboxOff.MinHeight = 15;
            checkbox.CheckboxOver.MinWidth = checkbox.CheckboxOver.MinHeight = 15;

            // since we arent using this as a Component on an Entity we'll fake it here
            ui = new UICanvas();
            ui.OnAddedToEntity();
            ui.Stage.IsFullScreen = true;

            _table = new Table();
            _table.Top().Left();
            _table.Defaults().SetPadTop(4).SetPadLeft(4).SetPadRight(0).SetAlign(Align.Left);
            _table.SetBackground(new PrimitiveDrawable(new Color(40, 40, 40)));

            // wrap up the table in a ScrollPane
            _scrollPane = ui.Stage.AddElement(new ScrollPane(_table, _skin));

            // force a validate which will layout the ScrollPane and populate the proper scrollBarWidth
            _scrollPane.Validate();
            _scrollPane.SetSize(295 + _scrollPane.GetScrollBarWidth(), Screen.Height);
        }