コード例 #1
0
        protected override void LoadContent()
        {
            base.LoadContent();

            AddBackground("Backgrounds\\MainMenu");

            arrowImage = new PictureBox(Content.Load<Texture2D>("GUI\\leftarrowUp"));
            ControlManager.Add(arrowImage);

            startGame = new LinkLabel("The Story Begins");
            startGame.Selected += menuItem_Selected;
            ControlManager.Add(startGame);

            loadGame = new LinkLabel("The Story Continues");
            loadGame.Selected += menuItem_Selected;
            ControlManager.Add(loadGame);

            exitGame = new LinkLabel("The Story Ends");
            exitGame.Selected += menuItem_Selected;
            ControlManager.Add(exitGame);

            ControlManager.NextControl();
            ControlManager.FocusChanged += ControlManager_FocusChanged;

            Vector2 position = new Vector2(350, 500);
            foreach (Control c in ControlManager)
            {
                if (c is LinkLabel)
                {
                    c.Position = position;
                    position.Y += c.Size.Y + 5f;
                }
            }

            ControlManager_FocusChanged(startGame, EventArgs.Empty);
        }
コード例 #2
0
        private void CreateControls()
        {
            AddBackground("Backgrounds\\MainMenu");

            Label label = new Label("Select Character", new Vector2(StateManager.ScreenCentre.X, StateManager.ScreenCentre.Y / 2));
            ControlManager.Add(label);

            genderSelector = new LeftRightSelector(
                Content.Load<Texture2D>("GUI\\leftarrowUp"),
                Content.Load<Texture2D>("GUI\\rightarrowUp"),
                label.Position + new Vector2(0, StateManager.Viewport.Height / 6));
            genderSelector.SetItems(genderItems);
            genderSelector.SelectionChanged += selectionChanged;
            ControlManager.Add(genderSelector);

            classSelector = new LeftRightSelector(
                Content.Load<Texture2D>("GUI\\leftarrowUp"),
                Content.Load<Texture2D>("GUI\\rightarrowUp"),
                genderSelector.Position + new Vector2(0, StateManager.Viewport.Height / 6));
            classSelector.SetItems(classItems);
            classSelector.SelectionChanged += selectionChanged;
            ControlManager.Add(classSelector);

            LinkLabel acceptCharacter = new LinkLabel(
                "Accept this character.",
                classSelector.Position + new Vector2(0, StateManager.Viewport.Height / 6));
            acceptCharacter.Selected += new EventHandler(acceptCharacter_Selected);
            ControlManager.Add(acceptCharacter);

            characterImage = new PictureBox(
                characterImages[0, 0],
                new Vector2(StateManager.Viewport.Width * 0.75f, genderSelector.Position.Y),
                new Rectangle(0, 0, 32, 32));
            characterImage.Size = new Vector2(64, 64);
            ControlManager.Add(characterImage);

            ControlManager.NextControl();
        }
コード例 #3
0
ファイル: BaseScreen.cs プロジェクト: AlanWills/Mythology
 protected void AddBackground(string backgroundAsset)
 {
     PictureBox background = new PictureBox(Content.Load<Texture2D>(backgroundAsset), new Vector2(Viewport.Width, Viewport.Height) / 2);
     background.TabStop = false;
     ControlManager.Add(background);
 }