public UpperStatusBar(Vector2 Position,GamePlayer context, ControlManager controlManager) { this.ControlManager = controlManager; this.Context = context; this.OriginPosition = Position; #region setting labels resources = new Label(); resources.SpriteFont = GameFonts.GetFont("f5"); resources.Color = LabelColor; resources.SetPosition(GetAbsolutePosition(90,3)); resources.Text = "Resources: "+Context.Resources; ControlManager.Add(resources); score = new Label(); score.SpriteFont = GameFonts.GetFont("f5"); score.Color = LabelColor; score.SetPosition(GetAbsolutePosition(90+160, 3)); score.Text = "Score: " + Context.Score; ControlManager.Add(score); elapsedTime = new Label(); elapsedTime.SpriteFont = GameFonts.GetFont("f5"); elapsedTime.Color = LabelColor; elapsedTime.SetPosition(GetAbsolutePosition(90+160+160, 3)); elapsedTime.Text = "Population: "+Context.Population; ControlManager.Add(elapsedTime); #endregion }
public GameWorld(ControlManager controlManagerRef) { ControlManagerRef = controlManagerRef; Map = new TileMap(200, 400); MainPlayer = new GamePlayer(this); MainPlayer.Name = "Osama Abulail"; int cloudsCount = (Map.MapWidth*Map.MapHeight)/(20*20); CloudManager = new CloudManager(Map, cloudsCount, CloudDirection.West, 0.5f); MovementManager = new UnitMovementManager(this); SelectionManager = new UnitSelectionManager(this); DockManager = new DockManager(ControlManagerRef); UpperStatusBar = new UpperStatusBar(new Vector2(10, 0), MainPlayer, ControlManagerRef); _trees = new List<Tree>(); // generate random trees. Random r = new Random(); for (int i = 0; i < 4000; i++) { Point treeLoc = new Point(r.Next(0,Map.MapWidth), r.Next(0,Map.MapHeight)); if (Map.MapCellAt(treeLoc).Walkable) { Tree t = new Tree("tree" + r.Next(1, 26), this, treeLoc); _trees.Add(t); } } // border _border = new PictureBox(GameGraphics.GetTexture("gameplay_border").SourceTexture, new Rectangle(0, 0, 1366, 768)); ControlManagerRef.Add(_border); }
public override void Initialize() { base.Initialize(); const int Padding = 50; int top = Padding; const int buttonWidth = 200; const int buttonHeight = 50; var menuInfos = new[] { new Tuple <string, EventHandler>("Load Existing World", (sender, args) => ShowExistingWorld()), new Tuple <string, EventHandler>("Create New World", (sender, args) => ShowNewWorld()), new Tuple <string, EventHandler>("Return", (sender, args) => ScreenManager.SwapScreens(this, Constants.ScreenNames.MainMenu)) }; foreach (var menuInfo in menuInfos) { var menuButton = new Button(ControlManager.Manager) { Text = menuInfo.Item1, Top = top, Left = Padding, Width = buttonWidth, Height = buttonHeight }; menuButton.Init(); menuButton.Click += menuInfo.Item2; top += menuButton.Height + Padding; ControlManager.Add(menuButton); } }
private Panel CreateNewWorldInterface() { var panel = new Panel(ControlManager.Manager) { Width = 856, Height = 467, AutoScroll = true, Left = 300, Top = 50 }; panel.Init(); ControlManager.Add(panel); var newNameLabel = new Label(ControlManager.Manager) { Text = "New World Name :: ", Width = 200, Left = 16, Top = 16, Parent = panel }; var newName = new TextBox(ControlManager.Manager) { Name = "worldName", Parent = panel, Top = 16, Left = newNameLabel.Left + newNameLabel.Width, Width = 200 }; newName.Init(); var createWorld = new Button(ControlManager.Manager) { Text = "Create world", Top = 200, Left = 100, Width = 200, Parent = panel }; createWorld.Init(); createWorld.Click += (sender, args) => CreateNewWorld(newName.Text); return(panel); }
protected override void LoadContent() { base.LoadContent(); ContentManager content = Game.Content; Background = new PictureBox(GameRef.Content.Load <Texture2D>(@"Backgrounds\MenuBackground"), GameRef.ScreenRectangle); ControlManager.Add(Background); gold = new Label(); gold.Text = "Gold: " + player.Money; gold.Position = new Vector2(400, 0); title = new Label(); title.Text = " BulkShop"; item1 = new LinkLabel(); item2 = new LinkLabel(); ControlManager.Add(title); ControlManager.Add(gold); Vector2 pos = new Vector2(10, 120); populateLabels(pos); ControlManager.NextControl(); }
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); }
private void RemoveCombatMenu() { FakeAttack = new Label(); FakeAttack.Text = "Attack"; FakeAttack.Size = FakeAttack.SpriteFont.MeasureString(FakeAttack.Text); FakeAttack.Position = Attack.Position; SpecialLabel = new Label(); SpecialLabel.Text = Special.Text; SpecialLabel.Size = SpecialLabel.SpriteFont.MeasureString(SpecialLabel.Text); SpecialLabel.Position = Special.Position; ItemsLabel = new Label(); ItemsLabel.Text = "Items"; ItemsLabel.Size = ItemsLabel.SpriteFont.MeasureString(ItemsLabel.Text); ItemsLabel.Position = Items.Position; RunLabel = new Label(); RunLabel.Text = "Run"; RunLabel.Size = RunLabel.SpriteFont.MeasureString(RunLabel.Text); RunLabel.Position = Run.Position; ControlManager.Add(FakeAttack); ControlManager.Add(SpecialLabel); ControlManager.Add(ItemsLabel); ControlManager.Add(RunLabel); ControlManager.Remove(Attack); ControlManager.Remove(Special); ControlManager.Remove(Items); ControlManager.Remove(Run); }
protected override void LoadContent() { base.LoadContent(); ContentManager Content = Game.Content; background = new PictureBox(Content.Load <Texture2D>("Backgrounds/menu"), GameRef.ScreenRectangle); ControlManager.Add(background); startGame = new LinkLabel(); startGame.Text = "Start Game"; startGame.Position = new Vector2(700, 250); startGame.Selected += new EventHandler(startGame_Selected); ControlManager.Add(startGame); instructions = new LinkLabel(); instructions.Text = "Instructions"; instructions.Position = new Vector2(685, 350); instructions.Selected += new EventHandler(instructions_Selected); ControlManager.Add(instructions); about = new LinkLabel(); about.Text = "About"; about.Position = new Vector2(770, 450); about.Selected += new EventHandler(about_Selected); ControlManager.Add(about); ControlManager.NextControl(); }
protected override void LoadContent() { base.LoadContent(); AddBackground("Backgrounds\\MainMenu"); loadLinkLabel = new LinkLabel("Select game", new Vector2(Viewport.Width * 0.25f, Viewport.Height * 0.5f - ControlManager.SpriteFont.LineSpacing)); loadLinkLabel.Selected += new EventHandler(loadLinkLabel_Selected); ControlManager.Add(loadLinkLabel); exitLinkLabel = new LinkLabel("Back", new Vector2(loadLinkLabel.Position.X, loadLinkLabel.Position.Y + 2 * loadLinkLabel.SpriteFont.LineSpacing)); exitLinkLabel.Selected += new EventHandler(exitLinkLabel_Selected); ControlManager.Add(exitLinkLabel); loadListBox = new ListBox(Content.Load <Texture2D>("GUI\\listBoxImage"), Content.Load <Texture2D>("GUI\\rightarrowUp"), new Vector2(Viewport.Width * 0.5f, Viewport.Height * 0.5f)); 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(); }
private void CreateMenuButtons() { int top = Padding; const int buttonWidth = 200; const int buttonHeight = 50; var menuInfos = new[] { new Tuple <string, EventHandler>("Play Game", (sender, args) => StartGame()), new Tuple <string, EventHandler>("Add Player", (sender, args) => AddPlayer()), new Tuple <string, EventHandler>("Remove Player", (sender, args) => RemovePlayer()), new Tuple <string, EventHandler>("Main Menu", (sender, args) => ScreenManager.SwapScreens(this, Constants.ScreenNames.MainMenu)) }; foreach (var menuInfo in menuInfos) { var menuButton = new Button(ControlManager.Manager) { Text = menuInfo.Item1, Top = top, Left = Padding, Width = buttonWidth, Height = buttonHeight }; menuButton.Init(); menuButton.Click += menuInfo.Item2; top += menuButton.Height + Padding; ControlManager.Add(menuButton); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> public override void Initialize() { base.Initialize(); CameraPos = _gameInfo.Spinner.Center; _gameInfo.Manager = ControlManager.Manager; // Set up our konami code callback to give the current player 0xBEEF _konami = new InputListener { Keys = new List <int> { 38, 38, 40, 40, 37, 39, 37, 39, 66, 65 }.Cast <Keys>().ToArray(), Callback = () => { _fsm.Push(new ModifyCash(0xBEEF)); ControlManager.Add(new Alert(ControlManager.Manager, "Konami code detected! Acquire 0xBEEF", "Konami Code Activated")); } }; _teleport = new InputListener { Keys = new[] { Keys.T, Keys.E, Keys.L, Keys.E, Keys.P, Keys.O, Keys.R, Keys.T }, Callback = () => { _gameInfo.Fsm.Push(new Teleport()); ControlManager.Add(new Alert(ControlManager.Manager, "Click the place you want to teleport to!", "Teleport Activated")); } }; CreateWelcomeMessage(); }
private void CreateControls() { AddBackground("Backgrounds\\MainMenu"); float padding = ControlManager.SpriteFont.LineSpacing + 10f; string skillPath = Content.RootDirectory + "\\Game\\Skills"; string[] skillFiles = Directory.GetFiles(skillPath, "*.xnb"); for (int i = 0; i < skillFiles.Length; i++) { skillFiles[i] = "Game\\Skills\\" + Path.GetFileNameWithoutExtension(skillFiles[i]); } List <SkillData> skillData = new List <SkillData>(); Vector2 nextControlPosition = new Vector2(300, 150); pointsRemaining = new Label("Skill Points: " + unassignedPoints.ToString(), nextControlPosition); ControlManager.Add(pointsRemaining); nextControlPosition.Y += padding; foreach (string s in skillFiles) { SkillData data = Content.Load <SkillData>(s); Label label = new Label(data.Name, nextControlPosition); label.Type = data.Name; ControlManager.Add(label); Label sLabel = new Label("0", new Vector2(nextControlPosition.X + 300, nextControlPosition.Y)); ControlManager.Add(sLabel); LinkLabel linkLabel = new LinkLabel("+", new Vector2(nextControlPosition.X + 350, nextControlPosition.Y)); linkLabel.Type = data.Name; linkLabel.Selected += addSkillLabel_Selected; ControlManager.Add(linkLabel); nextControlPosition.Y += padding; skillLabels.Add(new SkillLabelSet(label, sLabel, linkLabel)); } nextControlPosition.Y += padding; LinkLabel undoLabel = new LinkLabel("Undo", nextControlPosition); undoLabel.Selected += new EventHandler(undoLabel_Selected); ControlManager.Add(undoLabel); nextControlPosition.Y += padding; LinkLabel acceptLabel = new LinkLabel("Accept Changes", nextControlPosition); acceptLabel.Selected += new EventHandler(acceptLabel_Selected); ControlManager.Add(acceptLabel); ControlManager.NextControl(); }
public override void Initialize() { base.Initialize(); var top = 50; foreach (var screenName in ScreensNames) { var button = new Button(ControlManager.Manager) { Text = screenName, Left = 50, Top = top, Width = 200, Height = 50 }; button.Init(); var label1 = screenName; button.Click += (sender, args) => OpenScreen(label1); ControlManager.Add(button); top += 100; } if (ExitButton) { var button = new Button(ControlManager.Manager) { Text = "Exit Game", Left = 50, Top = top, Width = 200, Height = 50 }; button.Init(); button.Click += (sender, args) => Application.MainWindow.Close(); ControlManager.Add(button); } }
protected override void LoadContent() { ContentManager Content = GameRef.Content; backgroundImage = Content.Load <Texture2D>(@"Backgrounds/SpaceWizard"); base.LoadContent(); LinkLabel startLabel = new LinkLabel(); startLabel.Position = new Vector2(500, 500); startLabel.Text = "Press ENTER to begin"; startLabel.Color = Color.White; startLabel.TabStop = true; startLabel.HasFocus = true; startLabel.Selected += new EventHandler(startLabel_Selected); LinkLabel quitLabel = new LinkLabel(); quitLabel.Position = new Vector2(0, 25); quitLabel.Text = "Press ESC to quit"; quitLabel.Color = Color.White; quitLabel.TabStop = false; quitLabel.HasFocus = false; quitLabel.Selected += new EventHandler(quitLabel_Selected); ControlManager.Add(startLabel); }
private void WorldReady(List <WorldObject> worldObjects, GameInfoLoader gameInfoLoader) { if (worldObjects == null) { var alert = new Alert(ControlManager.Manager, "That world has become corrupt!\nPlease choose or create a different world", "Invalid world!"); ControlManager.Add(alert); return; } var playerList = new Player[_playerCount]; var i = 0; foreach (var tabPage in _tabs.TabPages) { if (tabPage == _gameInfoTab) { continue; } var player = playerList[i] = _playerObjectEditors[tabPage].CreateInstance(); player.Cash = Constants.GameRules.StartingCash; player.Gender = Constants.DefaultPlayerInfo.NamesAndColors.First(tuple => tuple.Item2 == player.PlayerColor).Item3; player.InitializeContent(Content); // Give them their basic car transport player.SetTransport(TransportType.Car); i++; } var gameInfo = new GameInfo(worldObjects, playerList, gameInfoLoader.AgeCounterTarget, gameInfoLoader.GameRuleType); var level = new Level(gameInfo); ScreenManager.AddGameLayer(level); ScreenManager.SwapScreens(this, level); }
private void StartGame() { var gameLoaderObject = _gameLoaderEditor.CreateInstance(); // Test if the user inputted the a valid amount of years if (gameLoaderObject.GameRuleType == GameRuleType.Retirement && (gameLoaderObject.AgeCounterTarget < MinAge || gameLoaderObject.AgeCounterTarget > MaxAge)) { ControlManager.Add(new Alert(ControlManager.Manager, String.Format("Sorry, the world target age must be between\n{0} and {1}!", MinAge, MaxAge), "Invalid Target World Age", icon: "Images/AlertIcons/Fail")); SwitchToTab(0); } else { if (gameLoaderObject.LoadingWorld == Constants.Locations.DefaultWorldName) { WorldLoader.instance.LoadWorld(Constants.Locations.DefaultWorldPath, worldObjects => WorldReady(worldObjects, gameLoaderObject)); } else if (gameLoaderObject.LoadingWorld == Constants.Locations.TestWorldName) { WorldLoader.instance.LoadWorld(Constants.Locations.TestWorldPath, worldObjects => WorldReady(worldObjects, gameLoaderObject)); } else { WorldLoader.instance.LoadCustomWorld(gameLoaderObject.LoadingWorld, worldObjects => WorldReady(worldObjects, gameLoaderObject)); } } }
private void CreateControls() { Texture2D leftTexture = Game.Content.Load <Texture2D>(@"GUI\leftarrowUp"); Texture2D rightTexture = Game.Content.Load <Texture2D>(@"GUI\rightarrowUp"); 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 = "Choose Your Ship"; 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);*/ shipSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture); shipSelector.SetItems(shipItems, 125); shipSelector.Position = new Vector2(label1.Position.X, 250); shipSelector.SelectionChanged += selectionChanged; ControlManager.Add(shipSelector); LinkLabel linkLabel1 = new LinkLabel(); linkLabel1.Text = "Use this Ship."; linkLabel1.Position = new Vector2(label1.Position.X, 300); linkLabel1.Selected += new EventHandler(linkLabel1_Selected); ship = shipSelector.getItem(); //Debug.WriteLine("hgfhfdgdffgs "+ship); ControlManager.Add(linkLabel1); shipImage = new PictureBox( shipImages[0], new Rectangle(600, 200, 96, 96)); ControlManager.Add(shipImage); ControlManager.NextControl(); //Go Back button LinkLabel goBack = new LinkLabel(); goBack.Text = "Go Back"; goBack.Position = new Vector2(label1.Position.X, 450); goBack.Selected += new EventHandler(goBackButton); ControlManager.Add(goBack); }
private void CreateMenu() { _menuManager = new MenuManager(_gameInfo, ControlManager, ReturnToMenu); var menuButton = _menuManager.CreateMenuButton(); menuButton.SetPosition(ScreenWidth - menuButton.Width - 20, ScreenHeight - menuButton.Height - 20); ControlManager.Add(menuButton); }
void addKeys(String characterName) { string appendedString = characterName; name.Position = new Vector2(xPos + 5, yPos); name.Text += appendedString; ControlManager.Add(name); }
private void CreateAlert(String message, String icon) { var alert = new Alert(ControlManager.Manager, message, icon: icon); EnableWorld(false); alert.Closed += (sender, args) => EnableWorld(true); ControlManager.Add(alert); }
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); InitialPrice = new LinkLabel(); InitialPrice.Text = "Change the Initial Price for Resources"; InitialPrice.Size = InitialPrice.SpriteFont.MeasureString(InitialPrice.Text); InitialPrice.Selected += new EventHandler(menuItem_Selected); ControlManager.Add(InitialPrice); Continue = new LinkLabel(); Continue.Text = "Continue on"; Continue.Size = Continue.SpriteFont.MeasureString(Continue.Text); Continue.Selected += new EventHandler(menuItem_Selected); ControlManager.Add(Continue); ControlManager.NextControl(); ControlManager.FocusChanged += new EventHandler(ControlManager_FocusChanged); Vector2 position = new Vector2(350, 300); 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(InitialPrice, null); }
protected override void LoadContent() { base.LoadContent(); var content = Game.Content; _backgroundImage = new PictureBox( content.Load <Texture2D>(@"Backgrounds\startScreen"), GameRef.ScreenRectangle); ControlManager.Add(_backgroundImage); var arrowTexture = content.Load <Texture2D>(@"GUI\leftarrowUp"); _arrowImage = new PictureBox( arrowTexture, new Rectangle(0, 0, arrowTexture.Width, arrowTexture.Height)); ControlManager.Add(_arrowImage); _startGame = new LinkLabel { Text = "The story begins" }; _startGame.Size = _startGame.SpriteFont.MeasureString(_startGame.Text); _startGame.Selected += menuItem_Selected; ControlManager.Add(_startGame); _loadGame = new LinkLabel { Text = "The story continues" }; _loadGame.Size = _loadGame.SpriteFont.MeasureString(_loadGame.Text); _loadGame.Selected += menuItem_Selected; ControlManager.Add(_loadGame); _exitGame = new LinkLabel { Text = "The story ends" }; _exitGame.Size = _exitGame.SpriteFont.MeasureString(_exitGame.Text); _exitGame.Selected += menuItem_Selected; ControlManager.Add(_exitGame); ControlManager.NextControl(); ControlManager.FocusChanged += ControlManager_FocusChanged; var position = new Vector2(350, 500); foreach (var c in ControlManager.OfType <LinkLabel>()) { if (c.Size.X > _maxItemWidth) { _maxItemWidth = c.Size.X; } c.Position = position; position.Y += c.Size.Y + 5f; } ControlManager_FocusChanged(_startGame, EventArgs.Empty); }
protected override void LoadContent() { base.LoadContent(); ContentManager Content = Game.Content; backgroundImage = new PictureBox( Content.Load <Texture2D>("Box"), 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[11]; for (int i = 2; i < startGame.Length; i++) { startGame[i] = new LinkLabel(); startGame[i].Text = i + " Players"; startGame[i].Size = startGame[i].SpriteFont.MeasureString(startGame[i].Text); startGame[i].Selected += new EventHandler(menuItem_Selected); ControlManager.Add(startGame[i]); } ControlManager.NextControl(); ControlManager.FocusChanged += new EventHandler(ControlManager_FocusChanged); Vector2 position = new Vector2(350, 200); 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[2], null); }
private Panel CreateExistingWorldInterface(String[] worldNames) { var panel = new Panel(ControlManager.Manager) { Width = 856, Height = 467, AutoScroll = true, Left = 300, Top = 50 }; panel.Init(); ControlManager.Add(panel); if (!worldNames.Any()) { var label = new Label(ControlManager.Manager) { Height = 50, Left = 20, Width = 400, Text = "There are no existing worlds to edit!\nSelect the Create New World tab to create one." }; panel.Add(label); return(panel); } var existingWorldLabel = new Label(ControlManager.Manager) { Text = "Existing World :: ", Width = 200, Left = 16, Top = 16, Parent = panel }; var worldNamesSelection = new ComboBox(ControlManager.Manager) { Width = 200, Parent = panel, Top = 16, Left = existingWorldLabel.Left + existingWorldLabel.Width + 20 }; worldNamesSelection.Items.AddRange(worldNames); worldNamesSelection.Init(); worldNamesSelection.ItemIndex = 0; worldNamesSelection.Left = existingWorldLabel.Left + existingWorldLabel.Width + 16; panel.Add(worldNamesSelection); var beginWorldEditor = new Button(ControlManager.Manager) { Text = "Load world", Top = 200, Left = 100, Width = 200 }; beginWorldEditor.Init(); beginWorldEditor.Click += (sender, args) => LoadExistingWorld(worldNamesSelection.Text); panel.Add(beginWorldEditor); return(panel); }
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 = "The farming begins"; startGame.Size = startGame.SpriteFont.MeasureString(startGame.Text); startGame.Selected += new EventHandler(menuItem_Selected); ControlManager.Add(startGame); loadGame = new LinkLabel(); loadGame.Text = "The farming continues"; loadGame.Size = loadGame.SpriteFont.MeasureString(loadGame.Text); loadGame.Selected += menuItem_Selected; ControlManager.Add(loadGame); exitGame = new LinkLabel(); exitGame.Text = "The farming ends"; exitGame.Size = exitGame.SpriteFont.MeasureString(exitGame.Text); exitGame.Selected += 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 CreateSideBar() { _sideBar = new SideBar(ControlManager.Manager) { StayOnBack = true, Passive = true, Width = 250, Height = ScreenHeight }; _sideBar.Left = ScreenWidth - _sideBar.Width; _sideBar.Init(); ControlManager.Add(_sideBar); }
private void attackLabel_Selected(object sender, EventArgs e) { if (!textBox) { LinkLabel temp = sender as LinkLabel; isSpecialAttack = (temp.Text == "Attack") ? false : true; if (isSpecialAttack) { Special.HasFocus = false; } else { Attack.HasFocus = false; } if (isSpecialAttack && (int.Parse(PlayerMana.Text) <= 0)) { showDialog(OutOfMana); RemoveCombatMenu(); PlayerTurn(); } if (!textBox) { sb = new StringBuilder("You gained the following items:" + "\n"); firstEnemy = new LinkLabel(); firstEnemy.Selected += Enemy_Selected; firstEnemy.Text = EnemyName.Text; firstEnemy.Size = firstEnemy.SpriteFont.MeasureString(firstEnemy.Text); firstEnemy.Position = EnemyName.Position; ControlManager.Add(firstEnemy); if (Enemies.Count > 1) { SecondEnemy = new LinkLabel(); SecondEnemy.Text = SecondEnemyName.Text; SecondEnemy.Position = SecondEnemyName.Position; SecondEnemy.Size = SecondEnemy.SpriteFont.MeasureString(SecondEnemy.Text); SecondEnemy.Selected += Enemy_Selected; ControlManager.Add(SecondEnemy); RemoveCombatMenu(); firstEnemy.HasFocus = true; ControlManager_FocusedChanged(firstEnemy, null); } else { DamageEnemy(Enemies[0]); RemoveCombatMenu(); EnemyTurn(); } } } }
public GameInterface(Player player, SpriteFont font) { this.player = player; controlManager = new ControlManager(font); healthLabel = new Label(); healthLabel.Color = Color.Cyan; healthLabel.Text = "Health: " + player.Health.ToString(); controlManager.Add(healthLabel); }
private void CreateTabs() { _tabs = new TabControl(ControlManager.Manager); _tabs.Init(); _tabs.SetPosition(300, 50); _tabs.MinimumHeight = 467; _tabs.MinimumWidth = 856; ControlManager.Add(_tabs); }
private void OpenScreen(String label) { if (ScreenManager.ShowScreen(label)) { ScreenManager.HideScreen(LayerName); } else { ControlManager.Add(new Alert(ControlManager.Manager, "Not implemented")); } }
protected override void LoadContent() { base.LoadContent(); ContentManager Content = Game.Content; Background = new PictureBox( Content.Load <Texture2D>(@"Backgrounds\spacewizardstitle"), GameRef.ScreenRectangle); ControlManager.Add(Background); Texture2D arrowTexture = Content.Load <Texture2D>(@"GUI\leftarrowUp"); arrow = new PictureBox( arrowTexture, new Rectangle(0, 0, arrowTexture.Width, arrowTexture.Height)); ControlManager.Add(arrow); start = new LinkLabel(); start.Text = "Start Game"; start.Size = start.SpriteFont.MeasureString(start.Text); start.Selected += new EventHandler(menu_Selected); ControlManager.Add(start); load = new LinkLabel(); load.Text = "Load Game"; load.Size = load.SpriteFont.MeasureString(load.Text); load.Selected += menu_Selected; exit = new LinkLabel(); exit.Text = "Quit Game"; exit.Size = exit.SpriteFont.MeasureString(exit.Text); exit.Selected += menu_Selected; ControlManager.Add(exit); ControlManager.NextControl(); ControlManager.FocusedChanged += new EventHandler(ControlManager_FocusedChanged); Vector2 position = new Vector2(375, 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_FocusedChanged(start, 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); Texture2D texture = new Texture2D(GraphicsDevice, 300, 300); Color[] data = new Color[300 * 300]; for (int i = 0; i < 300 * 300; i++) { data[i] = Color.White; } texture.SetData(data); loadListBox = new ListBox( texture, 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(); }
private void SetUpDialog(int targetState) { if (GameStateManager.CurrentState != this) GameStateManager.PushState(this); controls = new ControlManager(font); controls.selectedControl = 0; curState = Char1.Dialog.getCurrentState(); DialogLabel.Text = curState.stateText; DialogLabel.TabStop = false; DialogLabel.Position = new Vector2(20, 20); DialogLabel.SpriteFont = font; if (!controls.Contains(DialogLabel)) controls.Add(DialogLabel); Vector2 pos = new Vector2(300, 300); foreach (Response res in curState.responses) { LinkLabel response = new LinkLabel(); response.Text = res.responseText; response.Value = res.nextStateID; response.Function = res.OnSelect; response.Position = pos; response.Selected += dialog_selected; response.SpriteFont = font; pos.Y += 32; controls.Add(response); } }
public override void LargeLoadContent(object sender) { var Content = gameRef.Content; background = new DrawableRectangle(gameRef.GraphicsDevice, new Vector2(10, 10), Color.Black, true).Texture; levelManager = new LevelManager(gameRef); Camera.Initialize(Vector2.Zero, new Rectangle(0, 0, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT), new Vector2(LevelManager.CurrentLevel.WidthInPixels, LevelManager.CurrentLevel.HeightInPixels)); Camera.MaxClamp -= new Vector2(Camera.View.Width / 2, Camera.View.Height / 2); entityManager = new EntityManager(gameRef); if (!loadedGame) { EntityManager.Player.Name = Config.currentlyPlaying; if (LevelManager.CurrentLevel.PlayerSpawnPoint.X > -1 && LevelManager.CurrentLevel.PlayerSpawnPoint.Y > -1) EntityManager.Player.Position = new Vector2(LevelManager.CurrentLevel.PlayerSpawnPoint.X, LevelManager.CurrentLevel.PlayerSpawnPoint.Y) * Engine.TileWidth ; } else { Config.SetLastLogin(loadedProps.Name); Config.currentlyPlaying = loadedProps.Name; EntityManager.Player.LoadFromData(loadedProps); } new Pathfinder(LevelManager.CurrentLevel); #region Pause_Normal pauseControls_Normal = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>("Fonts\\default")); { Label lblPauseDisplay = new Label() { Name = "lblPauseDisplay", Text = "P A U S E D", Color = Color.White }; lblPauseDisplay.Position = new Vector2(MainGame.GAME_WIDTH / 2 - lblPauseDisplay.Width / 2, MainGame.GAME_HEIGHT / 1.8f - lblPauseDisplay.Height - 10); var back = new LinkLabel(1) { Name = "lnklblBack", Text = "Resume" }; var save = new LinkLabel(2) { Name = "lnklblSave", Text = "Save Game" }; var quit = new LinkLabel(3) { Name = "lnklblQuit", Text = "Quit to Menu" }; pauseControls_Normal.Add(lblPauseDisplay); pauseControls_Normal.Add(back); pauseControls_Normal.Add(save); pauseControls_Normal.Add(quit); Vector2 startPos = new Vector2(MainGame.GAME_WIDTH / 2, MainGame.GAME_HEIGHT / 1.8f); foreach (Control c in pauseControls_Normal) { if (c is LinkLabel) { var l = (LinkLabel)c; var offset = new Vector2(c.Width / 2, 0); c.Position = startPos - offset; c.Selected += new EventHandler(LinkLabel_Selected); c.Effect = ControlEffect.PULSE; c.Color = Color.Black; l.OnMouseIn += LinkLabel_OnMouseIn; startPos.Y += c.Height + 10f; } } } #endregion #region Pause_Save pauseControls_Save = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>("Fonts\\default")); Label status = new Label(); status.AutoSize = true; status.Text = "Save game success!"; status.Position = new Vector2(MainGame.GAME_WIDTH / 2 - status.Width / 2, MainGame.GAME_HEIGHT / 2 - status.Height); pauseControls_Save.Add(status); LinkLabel goBack_Save = new LinkLabel(0); goBack_Save.AutoSize = true; goBack_Save.Text = "Go Back"; goBack_Save.Position = new Vector2(MainGame.GAME_WIDTH / 2 - goBack_Save.Width / 2, status.Position.Y + status.Height + 10); goBack_Save.Selected += (o, e) => { pauseState = State_Paused.Normal; }; goBack_Save.OnMouseIn += LinkLabel_OnMouseIn; pauseControls_Save.Add(goBack_Save); #endregion #region Pause_Quit pauseControls_Quit = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>("Fonts\\default")); Label areYouSure1 = new Label(); areYouSure1.Name = "lblAreYouSure?"; areYouSure1.Text = "Are you sure you want to quit?"; areYouSure1.Position = new Vector2(MainGame.GAME_WIDTH / 2 - areYouSure1.SpriteFont.MeasureString( areYouSure1.Text).X / 2, 140); pauseControls_Quit.Add(areYouSure1); LinkLabel yes = new LinkLabel(1) { Name = "lnklblYes", Text = "Yes" }; yes.Position = new Vector2(areYouSure1.Position.X + 40, areYouSure1.Position.Y + areYouSure1.Height + 50); yes.OnMouseIn += LinkLabel_OnMouseIn; yes.Selected += (o, e) => { SwitchStateWithFade(new MainMenuState(gameRef, StateManager)); }; yes.Effect = ControlEffect.PULSE; LinkLabel no = new LinkLabel(2) { Name = "lnklblNo", Text = "No" }; no.Position = new Vector2(areYouSure1.Position.X + areYouSure1.Width - no.Width - 40, yes.Position.Y); no.OnMouseIn += LinkLabel_OnMouseIn; no.Selected += (o, e) => { pauseState = State_Paused.Normal; }; no.Effect = ControlEffect.PULSE; pauseControls_Quit.Add(yes); pauseControls_Quit.Add(no); #endregion blurOverlay = new GaussianBlur(gameRef); renderTargetWidth = MainGame.GAME_WIDTH; renderTargetHeight = MainGame.GAME_HEIGHT; blurOverlay.ComputeKernel(7, 2.0f); mainTarget = new RenderTarget2D(gameRef.GraphicsDevice, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT); target1 = new RenderTarget2D(gameRef.GraphicsDevice, renderTargetWidth, renderTargetHeight, false, gameRef.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); target2 = new RenderTarget2D(gameRef.GraphicsDevice, renderTargetWidth, renderTargetHeight, false, gameRef.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); blurOverlay.ComputeOffsets(renderTargetWidth, renderTargetHeight); quests = new QuestManager(); Quest q = new Quest(0, (QuestGiver)EntityManager.Npcs[0], EntityManager.Player); q.CheckSuccess += (delegate() { return EntityManager.Player.NoClip == true; }); quests.AddQuest(q); ((QuestGiver)EntityManager.Npcs[0]).Quest = q; ((QuestGiver)EntityManager.Npcs[0]).OnQuestCompleted += (delegate(object sender2, EventArgs args) { var questGiverSender = (QuestGiver)sender2; questGiverSender.Dialogues[0] = "Good job!"; }); base.LargeLoadContent(sender); }
protected override void LoadContent() { base.LoadContent(); var Content = gameRef.Content; IOManager.Init(); blackOverlay = new DrawableRectangle(GraphicsDevice, new Vector2(MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT), Color.White, true).Texture; blurOverlay = new GaussianBlur(gameRef); blurOverlay.ComputeKernel(7, 2.0f); titleImage = Content.Load<Texture2D>("Images\\title"); title = new Label(); title.SpriteFont = Content.Load<SpriteFont>("Fonts\\title"); title.Text = ""; title.Color = Color.White; title.Position = new Vector2(MainGame.GAME_WIDTH / 2 - title.Width / 2, 90); controls.Add(title); Texture2D[] images = new Texture2D[8]; for (int i = 0; i < images.Length; i++) { images[i] = Content.Load<Texture2D>("Images\\waterfall\\water" + i.ToString()); } anim = new Animation(images); #region Menu State menuControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default")); var start = new LinkLabel(0) { Name = "lnklblStart", Text = "New Game" }; var load = new LinkLabel(1) { Name = "lnklblLoad", Text = "Load Game" }; var options = new LinkLabel(2) { Name = "lnklblOptions", Text = "Options" }; var quit = new LinkLabel(3) { Name = "lnklblQuit", Text = "Quit Game" }; menuControls.Add(start); menuControls.Add(load); menuControls.Add(options); menuControls.Add(quit); Vector2 startPos = new Vector2(MainGame.GAME_WIDTH / 2, MainGame.GAME_HEIGHT / 1.8f); foreach (Control c in menuControls) { if (c is LinkLabel) { var l = (LinkLabel)c; var offset = new Vector2(c.Width / 2, 0); c.Position = startPos - offset; c.Selected += new EventHandler(LinkLabel_Selected); c.Effect = ControlEffect.PULSE; c.Color = Color.Black; ((LinkLabel)c).SelectedColor = Color.DarkBlue; l.OnMouseIn += LinkLabel_OnMouseIn; startPos.Y += c.Height + 10f; } } menuControls.SelectControl(0); #endregion #region New Game State newGameControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default")); Label prompt = new Label(); prompt.Text = "Enter your name"; prompt.Name = "lblNamePrompt"; prompt.Position = new Vector2(MainGame.GAME_WIDTH / 2 - prompt.SpriteFont.MeasureString(prompt.Text).X / 2, 200); newGameControls.Add(prompt); TextBox name = new TextBox(GraphicsDevice); name.Name = "txtName"; name.Position = new Vector2(prompt.Position.X + 40, prompt.Position.Y + prompt.Height + 10); name.BackColor = Color.Transparent; name.ForeColor = Color.White; newGameControls.Add(name); LinkLabel startGame = new LinkLabel(2) { Name = "lnklblNewGame", Text = "Start" }; startGame.Position = new Vector2(prompt.Position.X, name.Position.Y + 44); startGame.OnMouseIn += LinkLabel_OnMouseIn; startGame.Selected += (o, e) => { Config.currentlyPlaying = newGameControls[1].Text; SwitchStateWithFade(new LoadingState(gameRef, StateManager, new GameplayState(gameRef, StateManager))); }; startGame.Effect = ControlEffect.PULSE; LinkLabel cancel = new LinkLabel(3) { Name = "lnklblCancel", Text = "Cancel" }; cancel.Position = new Vector2(prompt.Position.X + prompt.Width - cancel.Width, startGame.Position.Y); cancel.OnMouseIn += LinkLabel_OnMouseIn; cancel.Selected += (o, e) => { currentState = State.Menu; }; cancel.Effect = ControlEffect.PULSE; newGameControls.Add(startGame); newGameControls.Add(cancel); #endregion #region Load Game State loadGameControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default")); List<EntityProperties> saves = new List<EntityProperties>(); saves = IOManager.GetAllPlayerDatas(); startPos = new Vector2(MainGame.GAME_WIDTH / 2, 0); int counter = 0; foreach (EntityProperties ep in saves) { var lnklblLoadSave = new LinkLabel(counter++); lnklblLoadSave.AutoSize = true; lnklblLoadSave.Name = "lnklblLoadSave"; lnklblLoadSave.Text = ep.Name + " | " + ep.TimeOfSave; lnklblLoadSave.OnMouseIn += LinkLabel_OnMouseIn; lnklblLoadSave.Selected += (o, e) => { SwitchStateWithFade(new LoadingState(gameRef, StateManager, new GameplayState(gameRef, StateManager, ep))); }; lnklblLoadSave.Effect = ControlEffect.PULSE; var offset = new Vector2(lnklblLoadSave.Width / 2, 0); lnklblLoadSave.Position = startPos - offset; startPos.Y += lnklblLoadSave.Height + 10; loadGameControls.Add(lnklblLoadSave); } var goBack_Load = new LinkLabel(loadGameControls.Count); goBack_Load.Name = "lnklblGoBackLoad"; goBack_Load.Text = "Go Back"; goBack_Load.Effect = ControlEffect.PULSE; goBack_Load.Position = new Vector2(MainGame.GAME_WIDTH / 2 - goBack_Load.Width / 2, MainGame.GAME_HEIGHT - goBack_Load.Height - 100); goBack_Load.OnMouseIn += LinkLabel_OnMouseIn; goBack_Load.Selected += (o, e) => { currentState = State.Menu; }; loadGameControls.Add(goBack_Load); #endregion #region Options Game State #endregion #region Quit State quitControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default")); Label areYouSure1 = new Label(); areYouSure1.Name = "lblAreYouSure?"; areYouSure1.Text = "Are you sure you want to quit?"; areYouSure1.Position = new Vector2(MainGame.GAME_WIDTH / 2 - areYouSure1.SpriteFont.MeasureString( areYouSure1.Text).X / 2, 140); quitControls.Add(areYouSure1); LinkLabel yes = new LinkLabel(1) { Name = "lnklblYes", Text = "Yes" }; yes.Position = new Vector2(areYouSure1.Position.X + 40, areYouSure1.Position.Y + areYouSure1.Height + 50); yes.OnMouseIn += LinkLabel_OnMouseIn; yes.Selected += (o, e) => { gameRef.Exit(); }; yes.Effect = ControlEffect.PULSE; LinkLabel no = new LinkLabel(2) { Name = "lnklblNo", Text = "No" }; no.Position = new Vector2(areYouSure1.Position.X + areYouSure1.Width - no.Width - 40, yes.Position.Y); no.OnMouseIn += LinkLabel_OnMouseIn; no.Selected += (o, e) => { currentState = State.Menu; }; no.Effect = ControlEffect.PULSE; quitControls.Add(yes); quitControls.Add(no); #endregion debugFont = Content.Load<SpriteFont>("Fonts\\version"); }
public void LoadContent() { background = gameRef.Content.Load<Texture2D>(@"Images/HUD/gradient"); var color = 210; controlColor = new Color(color, color, color); controls = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>(@"fonts\kootenay9")); layer1 = new Button() { Name = "btnLayer1", Text = "Layer 1", Value = 0 }; layer2 = new Button() { Name = "btnLayer2", Text = "Layer 2", Value = 1 }; layer3 = new Button() { Name = "btnLayer3", Text = "Layer 3", Value = 2 }; collisionLayer = new Button() { Name = "btnCollisionLayer", Text = "Collision Layer", Value = -1 }; controls.Add(layer1); controls.Add(layer2); controls.Add(layer3); controls.Add(collisionLayer); Vector2 startPos = new Vector2(0, 35); foreach (Button b in controls) { b.OnClick += LayerButtonClick; b.Position = startPos; startPos += new Vector2(0, b.Height + 10); } Button toggleShowCollision = new Button() { Name = "btnToggleShowCollision", Text = "Show Collision" }; toggleShowCollision.OnClick += (o, e) => { showCollisionMap = !showCollisionMap; }; toggleShowCollision.Position = controls[3].Position + new Vector2(0, collisionLayer.Height + 10); controls.Add(toggleShowCollision); Button selectTileSheet = new Button() { Name = "btnSelectTileSheet", Text = "Select Tile Sheet" }; selectTileSheet.OnClick += (o, e) => { gameRef.State = State.Freeze; frmGetTileSheet frm = new frmGetTileSheet(gameRef); frm.ShowDialog(); if (frm.DialogResult == System.Windows.Forms.DialogResult.OK) { selectedTileSetIndex = frm.SelectedTileSheetId; gameRef.level.CurrentTileSetIndex = selectedTileSetIndex; } gameRef.State = State.Playing; }; selectTileSheet.Position = controls[4].Position + new Vector2(0, collisionLayer.Height + 10); controls.Add(selectTileSheet); Button saveMap = new Button() { Name = "btnSaveMap", Text = "Save Map" }; saveMap.OnClick += (o, e) => { gameRef.State = State.Freeze; System.Windows.Forms.SaveFileDialog saveFileDlg = new System.Windows.Forms.SaveFileDialog(); saveFileDlg.FileName = "level1.slf"; saveFileDlg.Filter = "SLF level (.slf)|*.slf"; if (saveFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { // TODO: Save map with method Level.Save(@"File/path/here"); gameRef.level.Save(saveFileDlg.FileName); } gameRef.State = State.Playing; }; saveMap.Position = controls[5].Position + new Vector2(0, collisionLayer.Height + 10); controls.Add(saveMap); Button loadMap = new Button() { Name = "btnLoadMap", Text = "Load Map", Position = saveMap.Position + new Vector2(0, saveMap.Height + 10) }; loadMap.OnClick += (o, e) => { gameRef.State = State.Freeze; var openFileDlg = new System.Windows.Forms.OpenFileDialog(); openFileDlg.FileName = ""; openFileDlg.Filter = "SLF Level (.slf)|*.slf"; if (openFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { // TODO: Load map with method level.Load(@"File/path/here"); gameRef.level.Load(openFileDlg.FileName); } Camera.MaxClamp = new Vector2(gameRef.level.WidthInPixels - Canvas.CANVAS_WIDTH, gameRef.level.HeightInPixels - Canvas.CANVAS_HEIGHT); gameRef.State = State.Playing; }; controls.Add(loadMap); // Button to turn on the pencil tool Button pencil = new Button() { Name = "btnPencil", Text = "Pencil", Position = loadMap.Position + new Vector2(0, loadMap.Height + 10) }; pencil.OnClick += (o, e) => { selectedTool = Tool.Pencil; }; controls.Add(pencil); // Button to turn on the fill tool Button fill = new Button() { Name = "btnFill", Text = "Fill", Position = pencil.Position + new Vector2(0, loadMap.Height + 10) }; fill.OnClick += (o, e) => {selectedTool = Tool.Fill; }; controls.Add(fill); Label lblTileIndex = new Label() { Color = Color.Black, Name = "lblTileIndex", Text = "{X: " + gameRef.level.CurrentTileSet.SourceRectangles[SelectedTileIndex].X / Engine.TileWidth + ", " + "Y: " + gameRef.level.CurrentTileSet.SourceRectangles[SelectedTileIndex].Y / Engine.TileHeight + "}" }; lblTileIndex.Position = fill.Position + new Vector2(0, fill.Height + 10); controls.Add(lblTileIndex); Button newMap = new Button() { Name = "btnNewMap", Text = "New Map", Position = lblTileIndex.Position + new Vector2(0, lblTileIndex.Height + 10) }; newMap.OnClick += (o, e) => { gameRef.State = State.Freeze; new frmNewMap(gameRef).ShowDialog(); gameRef.State = State.Playing; }; controls.Add(newMap); Button playerSpawn = new Button() { Name = "btnPlayerSpawn", Text = "Set Player Spawn", Position = newMap.Position + new Vector2(0, newMap.Height + 10) }; playerSpawn.OnClick += (o, e) => { selectedTool = Tool.PlayerSpawn; }; controls.Add(playerSpawn); //selector = new TileSelector(gameRef, lblTileIndex.Position + new Vector2(0, lblTileIndex.Height + 10)); //selector.Width = HUD_WIDTH; }