示例#1
0
        /// <inheritdoc />
        public override void InitializeGUI()
        {
            _uiScreen = new Screen();
            _uiScreen.BackgroundImage = ResourceCache.GetSprite("ss14_logo_background");
            // added to interface manager in startup

            _bgPanel = new Panel();
            _bgPanel.BackgroundImage = ResourceCache.GetResource <SpriteResource>(@"Textures/UserInterface/TicketOverlay.png");
            _bgPanel.BackgroundColor = new Color(128, 128, 128, 128);
            _bgPanel.Alignment       = ControlAlignments.HCenter | ControlAlignments.VCenter;
            _bgPanel.Layout         += (sender, args) =>
            {
                _bgPanel.Width  = (int)(_uiScreen.Width * 0.85f);
                _bgPanel.Height = (int)(_uiScreen.Height * 0.85f);
            };
            _uiScreen.AddControl(_bgPanel);

            _lblTitle = new Label("Options", "CALIBRI", 48);
            _lblTitle.LocalPosition = new Vector2i(10, 10);
            _bgPanel.AddControl(_lblTitle);

            _lstResolution               = new Listbox(250, 150);
            _lstResolution.Alignment     = ControlAlignments.Bottom;
            _lstResolution.LocalPosition = new Vector2i(50, 50);
            _lstResolution.ItemSelected += _lstResolution_ItemSelected;
            PopulateAvailableVideoModes(_lstResolution);
            _lblTitle.AddControl(_lstResolution);

            _chkFullScreen               = new Checkbox();
            _chkFullScreen.Value         = ConfigurationManager.GetCVar <bool>("display.fullscreen");
            _chkFullScreen.ValueChanged += _chkFullScreen_ValueChanged;
            _chkFullScreen.Alignment     = ControlAlignments.Bottom;
            _chkFullScreen.LocalPosition = new Vector2i(0, 50);
            _lstResolution.AddControl(_chkFullScreen);

            _lblFullScreen               = new Label("Fullscreen", "CALIBRI");
            _lblFullScreen.Alignment     = ControlAlignments.Right;
            _lblFullScreen.LocalPosition = new Vector2i(3, 0);
            _chkFullScreen.AddControl(_lblFullScreen);

            _chkVSync               = new Checkbox();
            _chkVSync.Value         = ConfigurationManager.GetCVar <bool>("display.vsync");
            _chkVSync.ValueChanged += _chkVSync_ValueChanged;
            _chkVSync.Alignment     = ControlAlignments.Bottom;
            _chkVSync.LocalPosition = new Vector2i(0, 3);
            _chkFullScreen.AddControl(_chkVSync);

            _lblVSync               = new Label("Vsync", "CALIBRI");
            _lblVSync.Alignment     = ControlAlignments.Right;
            _lblVSync.LocalPosition = new Vector2i(3, 0);
            _chkVSync.AddControl(_lblVSync);

            _btnApply           = new Button("Apply Settings");
            _btnApply.Clicked  += _btnApply_Clicked;
            _btnApply.Alignment = ControlAlignments.Bottom | ControlAlignments.Right;
            _btnApply.Resize   += (sender, args) => { _btnApply.LocalPosition = new Vector2i(-10 + -_btnApply.ClientArea.Width, -10 + -_btnApply.ClientArea.Height); };
            _bgPanel.AddControl(_btnApply);

            _btnBack          = new Button("Back");
            _btnBack.Clicked += _btnBack_Clicked;
            _btnBack.Resize  += (sender, args) => { _btnBack.LocalPosition = new Vector2i(-10 + -_btnBack.ClientArea.Width, 0); };
            _btnApply.AddControl(_btnBack);
        }