Esempio n. 1
0
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentManager content = this.Game.Content;

            this.backgroundImage = new PictureBox(content.Load<Texture2D>(@"Backgrounds\menuScreen"), this.GameRef.ScreenRectangle);
            this.ControlManager.Add(this.backgroundImage);

            Texture2D arrowTexture = content.Load<Texture2D>(@"GUI\leftarrowUp");
            this.arrowImage = new PictureBox(arrowTexture, new Rectangle(0, 0, arrowTexture.Width, arrowTexture.Height));
            this.ControlManager.Add(this.arrowImage);

            this.startGame = new LinkLabel();
            this.startGame.Text = "The battle begins";
            this.startGame.Size = this.startGame.SpriteFont.MeasureString(this.startGame.Text);
            this.startGame.Selected += new EventHandler(this.MenuItemSelected);
            this.ControlManager.Add(this.startGame);

            this.gameCredits = new LinkLabel();
            this.gameCredits.Text = "The battle created by";
            this.gameCredits.Size = this.gameCredits.SpriteFont.MeasureString(this.gameCredits.Text);
            this.gameCredits.Selected += this.MenuItemSelected;
            this.ControlManager.Add(this.gameCredits);

            this.exitGame = new LinkLabel();
            this.exitGame.Text = "The battle ends.";
            this.exitGame.Size = this.exitGame.SpriteFont.MeasureString(this.exitGame.Text);
            this.exitGame.Selected += this.MenuItemSelected;
            this.ControlManager.Add(this.exitGame);

            this.ControlManager.NextControl(Keys.Down);

            this.ControlManager.FocusChanged += new EventHandler(this.ControlManagerFocusChanged);

            Vector2 position = new Vector2(270, 200);
            foreach (Control control in this.ControlManager)
            {
                if (control is LinkLabel)
                {
                    if (control.Size.X > this.maxLabelWidth)
                    {
                        this.maxLabelWidth = control.Size.X;
                    }

                    control.Position = position;
                    position.Y += control.Size.Y + 5f;
                }
            }

            this.ControlManagerFocusChanged(this.startGame, null);
        }
Esempio n. 2
0
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentManager content = this.GameRef.Content;

            this.backgroundImage = new PictureBox(content.Load<Texture2D>(@"Backgrounds\CreditsBackGround"), this.GameRef.ScreenRectangle);
            this.ControlManager.Add(this.backgroundImage);

            this.label1 = new Label();
            this.label1.Text = "Nikolay Nachev";
            this.label1.Color = Color.Red;
            this.label1.Position = new Vector2(150, 90);

            this.ControlManager.Add(this.label1);

            this.label2 = new Label();
            this.label2.Text = "Ladislav Grigorov";
            this.label2.Color = Color.Red;
            this.label2.Position = new Vector2(150, 180);

            this.ControlManager.Add(this.label2);

            this.label3 = new Label();
            this.label3.Text = "Stoyan Penchev";
            this.label3.Color = Color.Red;
            this.label3.Position = new Vector2(150, 270);

            this.ControlManager.Add(this.label3);

            this.label4 = new Label();
            this.label4.Text = "Ivaylo Hristov";
            this.label4.Color = Color.Red;
            this.label4.Position = new Vector2(150, 360);

            this.ControlManager.Add(this.label4);

            this.label5 = new Label();
            this.label5.Text = "Ivan Markov";
            this.label5.Color = Color.Red;
            this.label5.Position = new Vector2(150, 450);

            this.ControlManager.Add(this.label5);

            this.endLabel = new LinkLabel();
            this.endLabel.Text = "Press ENTER to get back to previous menu.";
            this.endLabel.Position = new Vector2((this.GameRef.Window.ClientBounds.Width - this.endLabel.SpriteFont.MeasureString(this.endLabel.Text).X) / 2, 500);
            this.endLabel.HasFocus = true;
            this.endLabel.Selected += this.EndLabel_Selected;

            this.ControlManager.Add(this.endLabel);
        }