private void CreateControls() { var leftTexture = Game.Content.Load<Texture2D>(@"GUI\leftarrowUp"); var rightTexture = Game.Content.Load<Texture2D>(@"GUI\rightarrowUp"); var stopTexture = Game.Content.Load<Texture2D>(@"GUI\StopBar"); _backgroundImage = new PictureBox( Game.Content.Load<Texture2D>(@"Backgrounds\startScreen"), GameRef.ScreenRectangle); ControlManager.Add(_backgroundImage); var label1 = new Label { Text = "Who shall Thy be?" }; label1.Size = label1.SpriteFont.MeasureString(label1.Text); label1.Position = new Vector2((GameRef.Window.ClientBounds.Width - label1.Size.X) / 2, 150); ControlManager.Add(label1); _genderSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture); _genderSelector.SetItems(_genderItems, 125); _genderSelector.Position = new Vector2(label1.Position.X, 200); ControlManager.Add(_genderSelector); _classSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture); _classSelector.SetItems(_classItems, 125); _classSelector.Position = new Vector2(label1.Position.X, 250); ControlManager.Add(_classSelector); var linklabel1 = new LinkLabel {Text = "Accept", Position = new Vector2(label1.Position.X, 300)}; linklabel1.Selected += linklabel1_Selected; ControlManager.Add(linklabel1); ControlManager.NextControl(); }
protected override void LoadContent() { base.LoadContent(); ContentManager Content = Game.Content; backgroundImage = new PictureBox(Content.Load<Texture2D>(@"Backgrounds\title"), gameRef.ScreenRectangle); ControlManager.Add(backgroundImage); Texture2D arrowTexture = Content.Load<Texture2D>(@"GUI\cursor"); arrowImage = new PictureBox(arrowTexture, new Rectangle(0,0,arrowTexture.Width,arrowTexture.Height)); ControlManager.Add(arrowImage); startGame = new LinkLabel(); startGame.Text = "The Story Begins"; startGame.Size = startGame.SpriteFont.MeasureString(startGame.Text); startGame.Selected += new EventHandler(menu_ItemSelected); ControlManager.Add(startGame); loadGame = new LinkLabel(); loadGame.Text = "The Story Continues"; loadGame.Size = startGame.SpriteFont.MeasureString(loadGame.Text); loadGame.Selected += menu_ItemSelected; ControlManager.Add(loadGame); exitGame = new LinkLabel(); exitGame.Text = "The Story Ends"; exitGame.Size = startGame.SpriteFont.MeasureString(exitGame.Text); exitGame.Selected += menu_ItemSelected; ControlManager.Add(exitGame); ControlManager.NextControl(); ControlManager.FocusChanged += new EventHandler(ControlManager_FocusChanged); Vector2 position = new Vector2(350, 500); foreach (Control c in ControlManager) { if (c.Size.X > maxItemWidth) { maxItemWidth = c.Size.X; } c.Position = position; position.Y = c.Position.Y + 40f; } ControlManager.FocusChanged(startGame, null); }
protected override void LoadContent() { base.LoadContent(); ContentManager Content = Game.Content; backgroundImage = new PictureBox( Content.Load<Texture2D>(@"Backgrounds\titlescreen"), GameRef.ScreenRectangle); ControlManager.Add(backgroundImage); loadLinkLabel = new LinkLabel(); loadLinkLabel.Text = "Select game"; loadLinkLabel.Position = new Vector2(50, 100); loadLinkLabel.Selected += new EventHandler(loadLinkLabel_Selected); ControlManager.Add(loadLinkLabel); exitLinkLabel = new LinkLabel(); exitLinkLabel.Text = "Back"; exitLinkLabel.Position = new Vector2(50, 100 + exitLinkLabel.SpriteFont.LineSpacing); exitLinkLabel.Selected += new EventHandler(exitLinkLabel_Selected); ControlManager.Add(exitLinkLabel); loadListBox = new ListBox( Content.Load<Texture2D>(@"GUI\listBoxImage"), Content.Load<Texture2D>(@"GUI\rightarrowUp")); loadListBox.Position = new Vector2(400, 100); loadListBox.Selected += new EventHandler(loadListBox_Selected); loadListBox.Leave += new EventHandler(loadListBox_Leave); for (int i = 0; i < 20; i++) loadListBox.Items.Add("Game number: " + i.ToString()); ControlManager.Add(loadListBox); ControlManager.NextControl(); }
protected override void LoadContent() { base.LoadContent(); ContentManager Content = Game.Content; backgroundImage = new PictureBox( Content.Load<Texture2D>(@"Backgrounds\titlescreen"), GameRef.ScreenRectangle); ControlManager.Add(backgroundImage); Texture2D arrowTexture = Content.Load<Texture2D>(@"GUI\leftarrowUp"); arrowImage = new PictureBox( arrowTexture, new Rectangle( 0, 0, arrowTexture.Width, arrowTexture.Height)); ControlManager.Add(arrowImage); startGame = new LinkLabel(); startGame.Text = "New Game"; startGame.Size = startGame.SpriteFont.MeasureString(startGame.Text); startGame.Selected += new EventHandler(menuItem_Selected); ControlManager.Add(startGame); loadGame = new LinkLabel(); loadGame.Text = "Load Game"; loadGame.Size = loadGame.SpriteFont.MeasureString(loadGame.Text); loadGame.Selected += new EventHandler(menuItem_Selected); ControlManager.Add(loadGame); exitGame = new LinkLabel(); exitGame.Text = "Exit"; exitGame.Size = exitGame.SpriteFont.MeasureString(exitGame.Text); exitGame.Selected +=new EventHandler(menuItem_Selected); ControlManager.Add(exitGame); ControlManager.NextControl(); ControlManager.FocusChanged += new EventHandler(ControlManager_FocusChanged); Vector2 position = new Vector2(350, 500); foreach (Control c in ControlManager) { if (c is LinkLabel) { if (c.Size.X > maxItemWidth) { maxItemWidth = c.Size.X; } c.Position = position; position.Y += c.Size.Y + 5f; } } ControlManager_FocusChanged(startGame, null); }
private void CreateControls() { Texture2D leftTexture = Game.Content.Load<Texture2D>(@"GUI\leftarrowUp"); Texture2D rightTexture = Game.Content.Load<Texture2D>(@"GUI\rightarrowUp"); Texture2D stopTexture = Game.Content.Load<Texture2D>(@"GUI\StopBar"); backgroundImage = new PictureBox( Game.Content.Load<Texture2D>(@"Backgrounds\titlescreen"), GameRef.ScreenRectangle); ControlManager.Add(backgroundImage); Label label1 = new Label(); label1.Text = "Who will search for the Eyes of the Dragon?"; label1.Size = label1.SpriteFont.MeasureString(label1.Text); label1.Position = new Vector2((GameRef.Window.ClientBounds.Width - label1.Size.X) / 2, 150); ControlManager.Add(label1); genderSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture); genderSelector.SetItems(genderItems, 125); genderSelector.Position = new Vector2(label1.Position.X, 200); genderSelector.SelectionChanged += new EventHandler(selectionChanged); ControlManager.Add(genderSelector); classSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture); classSelector.SetItems(classItems, 125); classSelector.Position = new Vector2(label1.Position.X, 250); classSelector.SelectionChanged += selectionChanged; ControlManager.Add(classSelector); LinkLabel linkLabel1 = new LinkLabel(); linkLabel1.Text = "Accept this character."; linkLabel1.Position = new Vector2(label1.Position.X, 300); linkLabel1.Selected += new EventHandler(linkLabel1_Selected); ControlManager.Add(linkLabel1); characterImage = new PictureBox( characterImages[0, 0], new Rectangle(500, 200, 96, 96), new Rectangle(0, 0, 32, 32)); ControlManager.Add(characterImage); ControlManager.NextControl(); }
private void CreateControls() { Texture2D leftTexture = Game.Content.Load<Texture2D>(@"GUI/leftarrow"); Texture2D righTexture = Game.Content.Load<Texture2D>(@"GUI/rightarrow"); Texture2D stopTexture = Game.Content.Load<Texture2D>(@"GUI/stopshield"); backgroundImage = new PictureBox(Game.Content.Load<Texture2D>(@"Backgrounds/title"), gameRef.ScreenRectangle); ControlManager.Add(backgroundImage); Label label = new Label(); label.Text = "Predict The Chosen One"; label.Size = label.SpriteFont.MeasureString(@"Fonts/ControlFont"); label.Position = new Vector2((gameRef.Window.ClientBounds.Width - label.Size.X) / 2 - 25, 400); ControlManager.Add(label); genderSelector = new LeftRightSelector(leftTexture, righTexture, stopTexture); genderSelector.SetItems(genderItems, 40); genderSelector.Position = new Vector2(395, 475); genderSelector.Selected += new EventHandler(SelectionChanged); ControlManager.Add(genderSelector); classSelector = new LeftRightSelector(leftTexture, righTexture, stopTexture); classSelector.SetItems(classItems, 40); classSelector.Position = new Vector2(395, 550); classSelector.Selected += SelectionChanged; ControlManager.Add(classSelector); LinkLabel link = new LinkLabel(); link.Text = "Accept His Fate"; link.Position = new Vector2(label.Position.X + 45, 625); link.Selected = new EventHandler(LinkLabel_Selected); ControlManager.Add(link); characterBox = new PictureBox(characterImages[0,0], new Rectangle(470,260,96,96), new Rectangle(0,0,32,32)); ControlManager.Add(characterBox); ControlManager.NextControl(); }
private void CreateControls(ContentManager Content) { backgroundImage = new PictureBox( Game.Content.Load<Texture2D>(@"Backgrounds\titlescreen"), GameRef.ScreenRectangle); ControlManager.Add(backgroundImage); Vector2 nextControlPosition = new Vector2(300, 150); pointsRemaining = new Label(); pointsRemaining.Text = "Skill Points: " + unassignedPoints.ToString(); pointsRemaining.Position = nextControlPosition; nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f; ControlManager.Add(pointsRemaining); foreach (string s in DataManager.SkillData.Keys) { SkillData data = DataManager.SkillData[s]; Label label = new Label(); label.Text = data.Name; label.Type = data.Name; label.Position = nextControlPosition; Label sLabel = new Label(); sLabel.Text = "0"; sLabel.Position = new Vector2( nextControlPosition.X + 300, nextControlPosition.Y); LinkLabel linkLabel = new LinkLabel(); linkLabel.TabStop = true; linkLabel.Text = "Add"; linkLabel.Type = data.Name; linkLabel.Position = new Vector2( nextControlPosition.X + 390, nextControlPosition.Y); nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f; linkLabel.Selected += addSkillLabel_Selected; ControlManager.Add(label); ControlManager.Add(sLabel); ControlManager.Add(linkLabel); skillLabels.Add(new SkillLabelSet(label, sLabel, linkLabel)); } nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f; LinkLabel undoLabel = new LinkLabel(); undoLabel.Text = "Undo"; undoLabel.Position = nextControlPosition; undoLabel.TabStop = true; undoLabel.Selected += new EventHandler(undoLabel_Selected); nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f; ControlManager.Add(undoLabel); LinkLabel acceptLabel = new LinkLabel(); acceptLabel.Text = "Accept Changes"; acceptLabel.Position = nextControlPosition; acceptLabel.TabStop = true; acceptLabel.Selected += new EventHandler(acceptLabel_Selected); ControlManager.Add(acceptLabel); ControlManager.NextControl(); }