/// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.GUI.Controls.vxSettingsGUIItem"/> class.
        /// </summary>
        /// <param name="position">Position.</param>
        public vxSettingsGUIItem(vxEngine Engine, vxGuiManager GUIManager, string Title, string Value, Vector2 position) : base(position)
        {
            GUIManager.Add(this);

            Label = new vxLabel(Engine, Title, position + new Vector2(10, 5));
            GUIManager.Add(Label);

            ValueComboBox = new vxComboBox(Engine, Value, position + new Vector2(200, 10));
            GUIManager.Add(ValueComboBox);

            Height = 40;
        }
Example #2
0
        /// <summary>
        /// Loads graphics content for this screen. This uses the shared ContentManager
        /// provided by the Game class, so the content will remain loaded forever.
        /// Whenever a subsequent MessageBoxScreen tries to load this same content,
        /// it will just get back another reference to the already loaded data.
        /// </summary>
        public override void LoadContent()
        {
            InternalvxGUIManager = new vxGuiManager();

            this.ArtProvider = (vxDialogArtProvider)vxEngine.vxGUITheme.ArtProviderForDialogs.Clone();

            //And just so that all is set up properly, resize anything based off of current resolution scale.
            ArtProvider.SetBounds();

            viewportSize = new Vector2(vxEngine.GraphicsDevice.Viewport.Width, vxEngine.GraphicsDevice.Viewport.Height);

            Btn_Apply  = new vxButton(vxEngine, btn_Apply_text, new Vector2(viewportSize.X / 2 - 115, viewportSize.Y / 2 + 20));
            Btn_Ok     = new vxButton(vxEngine, btn_ok_text, new Vector2(viewportSize.X / 2 - 115, viewportSize.Y / 2 + 20));
            Btn_Cancel = new vxButton(vxEngine, btn_ok_Cancel, new Vector2(viewportSize.X / 2 + 15, viewportSize.Y / 2 + 20));

            //Btn_Apply.Clicked += new EventHandler<vxGuiItemClickEventArgs>(Btn_Apply_Clicked);
            Btn_Ok.Clicked     += new EventHandler <vxGuiItemClickEventArgs>(Btn_Ok_Clicked);
            Btn_Cancel.Clicked += new EventHandler <vxGuiItemClickEventArgs>(Btn_Cancel_Clicked);

            if (ButtonTypes == vxEnumButtonTypes.OkApplyCancel)
            {
                InternalvxGUIManager.Add(Btn_Apply);
            }

            InternalvxGUIManager.Add(Btn_Ok);
            InternalvxGUIManager.Add(Btn_Cancel);

            spriteBatch = vxEngine.SpriteBatch;
            font        = vxEngine.vxGUITheme.Font;



            //Reset Gui Item Positions Based off of Background Rectangle
            Btn_Apply.Position = new Vector2(
                this.ArtProvider.BoundingGUIRectangle.X,
                this.ArtProvider.BoundingGUIRectangle.Y) + this.ArtProvider.PosOffset
                                 + new Vector2(
                this.ArtProvider.BoundingGUIRectangle.Width - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth * 3 - vxEngine.vxGUITheme.Padding.X * 3,
                this.ArtProvider.BoundingGUIRectangle.Height - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight * 2 - vxEngine.vxGUITheme.Padding.Y * 2);

            Btn_Ok.Position = new Vector2(
                this.ArtProvider.BoundingGUIRectangle.X,
                this.ArtProvider.BoundingGUIRectangle.Y) + this.ArtProvider.PosOffset
                              + new Vector2(
                this.ArtProvider.BoundingGUIRectangle.Width - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth * 2 - vxEngine.vxGUITheme.Padding.X * 2,
                this.ArtProvider.BoundingGUIRectangle.Height - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight * 2 - vxEngine.vxGUITheme.Padding.Y * 2);

            Btn_Cancel.Position = new Vector2(
                this.ArtProvider.BoundingGUIRectangle.X, this.ArtProvider.BoundingGUIRectangle.Y) + this.ArtProvider.PosOffset
                                  + new Vector2(
                this.ArtProvider.BoundingGUIRectangle.Width - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth - vxEngine.vxGUITheme.Padding.X,
                this.ArtProvider.BoundingGUIRectangle.Height - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight * 2 - vxEngine.vxGUITheme.Padding.Y * 2);
        }
        /// <summary>
        /// Initialises the level.
        /// </summary>
        public virtual void InitialiseLevel()
        {
            vxEngine.CurrentGameplayScreen = this;

            GUIManager = new vxGuiManager();

            if (content == null)
            {
                content = new ContentManager(vxEngine.Game.Services, "Content");
            }

            mGraphicsManager = vxEngine.Game.Services.GetService(typeof(IGraphicsDeviceService)) as GraphicsDeviceManager;


            LastFrame = new Texture2D(vxEngine.GraphicsDevice,
                                      vxEngine.GraphicsDevice.PresentationParameters.BackBufferWidth,
                                      vxEngine.GraphicsDevice.PresentationParameters.BackBufferHeight);
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Virtex.Lib.Vrtc.GUI.Controls.vxKeyBindingSettingsGUIItem"/> class.
        /// </summary>
        /// <param name="Engine">Engine.</param>
        /// <param name="GUIManager">GUI Manager.</param>
        /// <param name="Title">Title.</param>
        /// <param name="KeyBinding">Key binding.</param>
        /// <param name="position">Position.</param>
        public vxKeyBindingSettingsGUIItem(vxEngine Engine, vxGuiManager GUIManager, string Title, KeyBinding KeyBinding, object id, Vector2 position)
            : base(position)
        {
            GUIManager.Add(this);

            this.KeyBinding = KeyBinding;

            BindingID = id;

            Label = new vxLabel(Engine, Title, position + new Vector2(10, 5));
            GUIManager.Add(Label);

            Button          = new vxButton(Engine, KeyBinding.Key.ToString(), position + new Vector2(200, 10));
            Button.Clicked += delegate {
                TakingInput            = true;
                Button.Text            = "Press Any Key...";
                Button.Colour          = Color.CornflowerBlue;
                Button.Color_Normal    = Color.CornflowerBlue;
                Button.Color_Highlight = Color.CornflowerBlue;
            };
            GUIManager.Add(Button);

            Height = 40;
        }
Example #5
0
        /// <summary>
        /// Loads graphics content for this screen. This uses the shared ContentManager
        /// provided by the Game class, so the content will remain loaded forever.
        /// Whenever a subsequent MessageBoxScreen tries to load this same content,
        /// it will just get back another reference to the already loaded data.
        /// </summary>
        public override void LoadContent()
        {
            xGUIManager = new vxGuiManager();

            SetButtonText();

            Vector2 viewportSize = new Vector2(vxEngine.GraphicsDevice.Viewport.Width, vxEngine.GraphicsDevice.Viewport.Height);

            //Setup Buttons
            Btn_Apply           = new vxButton(vxEngine, btn_Apply_text, new Vector2(viewportSize.X / 2 - 115, viewportSize.Y / 2 + 20));
            Btn_Apply.Clicked  += Btn_Apply_Clicked;
            Btn_Ok              = new vxButton(vxEngine, btn_ok_text, new Vector2(viewportSize.X / 2 - 115, viewportSize.Y / 2 + 20));
            Btn_Ok.Clicked     += Btn_Ok_Clicked;
            Btn_Cancel          = new vxButton(vxEngine, btn_ok_Cancel, new Vector2(viewportSize.X / 2 + 15, viewportSize.Y / 2 + 20));
            Btn_Cancel.Clicked += Btn_Cancel_Clicked;

            if (ButtonTypes == vxEnumButtonTypes.OkApplyCancel)
            {
                xGUIManager.Add(Btn_Apply);
            }

            xGUIManager.Add(Btn_Ok);
            xGUIManager.Add(Btn_Cancel);


            spriteBatch = vxEngine.SpriteBatch;
            font        = vxEngine.vxGUITheme.Font;

            // Center the message text in the viewport.
            viewport          = vxEngine.GraphicsDevice.Viewport;
            textTitleSize     = font.MeasureString(Title);
            textSize          = font.MeasureString(message);
            textPosition      = (viewportSize - textSize) / 2;
            textTitlePosition = textPosition - new Vector2(0, 2 * vPad + textTitleSize.Y);

            //Set Gui Item Positions

            int length = Math.Max(vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth * 2 + (int)vxEngine.vxGUITheme.Padding.X * 2, (int)textSize.X);

            backgroundRectangle = new Rectangle(
                (int)textPosition.X - hPad,
                (int)textPosition.Y - vPad,
                length + hPad * 2,
                (int)textSize.Y + vPad + vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight + vPad * 2);

            TitleRectangle = new Rectangle(
                (int)textPosition.X - hPad,
                (int)textPosition.Y - (int)textTitleSize.Y - vPad * 2 - 5,
                length + hPad * 2,
                (int)textTitleSize.Y + vPad);

            SpriteFont ButtonFont = vxEngine.vxGUITheme.ArtProviderForButtons.Font;

            Btn_Apply.Position = new Vector2(backgroundRectangle.X, backgroundRectangle.Y) + new Vector2(
                backgroundRectangle.Width - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth * 3 - vxEngine.vxGUITheme.Padding.X * 3,
                backgroundRectangle.Height - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight - vxEngine.vxGUITheme.Padding.Y * 2);


            Btn_Ok.Position = new Vector2(backgroundRectangle.X, backgroundRectangle.Y) + new Vector2(
                backgroundRectangle.Width - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth * 2 - vxEngine.vxGUITheme.Padding.X * 2,
                backgroundRectangle.Height - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight - vxEngine.vxGUITheme.Padding.Y * 2);

            Btn_Cancel.Position = new Vector2(backgroundRectangle.X, backgroundRectangle.Y) + new Vector2(
                backgroundRectangle.Width - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth - vxEngine.vxGUITheme.Padding.X,
                backgroundRectangle.Height - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight - vxEngine.vxGUITheme.Padding.Y * 2);


            this.ArtProvider = (vxMessageBoxArtProvider)vxEngine.vxGUITheme.ArtProviderForMessageBoxes.Clone();
        }