public override void LoadContent() { #region Fonts var buttonFont = FontLoader.LoadFont("Retron2k/Retron2000.ttf", 36, _graphicsDevice); var titleFont1 = FontLoader.LoadFont("ModernSans/micross.ttf", 144, _graphicsDevice); var titleFont2 = FontLoader.LoadFont("Tangerine/Tangerine.ttf", 144, _graphicsDevice); #endregion #region Textures var backgroundTexture = _content.Load <Texture2D>("Backgrounds/tempMenuBackground"); var buttonTexture = _content.Load <Texture2D>("Controls/TitleButton"); var hoverButtonTexture = _content.Load <Texture2D>("Controls/TitleButtonInverted"); #endregion #region Background var menuBackground = new Image(backgroundTexture, Vector2.Zero); #endregion #region Text Boxes #region Title var monoText = new TextBox(titleFont1, "Mono"); var fantasyText = new TextBox(titleFont2, "fantasy"); float titleWidth = monoText.Size.X + fantasyText.Size.X; monoText.Position = new Vector2(_game.Window.ClientBounds.Width / 2 - titleWidth / 2, _game.Window.ClientBounds.Height / 6 - monoText.Size.Y / 2); fantasyText.Position = new Vector2(_game.Window.ClientBounds.Width / 2 - titleWidth / 2 + monoText.Size.X + 16, _game.Window.ClientBounds.Height / 6 - fantasyText.Size.Y / 2); #endregion #region Author var CSHText = new TextBox(buttonFont, "Computer Science House"); CSHText.Position = new Vector2(5, _game.Window.ClientBounds.Height - (5 + (int)buttonFont.MeasureString(CSHText.Text).Y)); #endregion #region Release var ReleaseText = new TextBox(buttonFont, $"Release: {_game.Release}"); ReleaseText.Position = new Vector2(_game.Window.ClientBounds.Width - (5 + (int)buttonFont.MeasureString(ReleaseText.Text).X), _game.Window.ClientBounds.Height - (5 + (int)buttonFont.MeasureString(ReleaseText.Text).Y)); #endregion #endregion #region Buttons var newGameButton = new Button(buttonTexture, buttonFont, hoverButtonTexture, Color.White) { Position = new Vector2(_game.Window.ClientBounds.Width / 2 - buttonTexture.Width / 2, (_game.Window.ClientBounds.Height / 3)), Text = "New Game" }; newGameButton.Click += newGameButton_Click; var continueGameButton = new Button(buttonTexture, buttonFont, hoverButtonTexture, Color.White) { Position = new Vector2(_game.Window.ClientBounds.Width / 2 - buttonTexture.Width / 2, (_game.Window.ClientBounds.Height / 3) + buttonTexture.Height * 1.5f), Text = "Continue" }; continueGameButton.Click += continueGameButton_Click; var settingsGameButton = new Button(buttonTexture, buttonFont, hoverButtonTexture, Color.White) { Position = new Vector2(_game.Window.ClientBounds.Width / 2 - buttonTexture.Width / 2, (_game.Window.ClientBounds.Height / 3) + buttonTexture.Height * 3.0f), Text = "Settings" }; settingsGameButton.Click += settingsGameButton_Click; var quitGameButton = new Button(buttonTexture, buttonFont, hoverButtonTexture, Color.White) { Position = new Vector2(_game.Window.ClientBounds.Width / 2 - buttonTexture.Width / 2, (_game.Window.ClientBounds.Height / 3) + buttonTexture.Height * 4.5f), Text = "Quit" }; quitGameButton.Click += quitGameButton_Click; #endregion Components = new List <Component>() { menuBackground, newGameButton, continueGameButton, settingsGameButton, quitGameButton, monoText, fantasyText, CSHText, ReleaseText }; }
// Loads UI fonts, textures, images, text boxed and buttons public override void LoadContent() { #region Fonts var buttonFont = FontLoader.LoadFont("Retron2k/Retron2000.ttf", 36, _graphicsDevice); var headerFont = FontLoader.LoadFont("Tangerine/Tangerine.ttf", 144, _graphicsDevice); #endregion #region Textures var backgroundTexture = _content.Load <Texture2D>("Backgrounds/tempMenuBackground"); var buttonTexture = _content.Load <Texture2D>("Controls/TitleButton"); var hoverButtonTexture = _content.Load <Texture2D>("Controls/TitleButtonInverted"); var backButtonTexture = _content.Load <Texture2D>("Controls/backButton"); var hoverBackButtonTexture = _content.Load <Texture2D>("Controls/backButtonInverted"); #endregion #region Background var menuBackground = new Image(backgroundTexture, Vector2.Zero); #endregion #region Text Boxes var newGameText = new TextBox(headerFont, "New Game"); newGameText.Position = new Vector2(_game.Window.ClientBounds.Width / 2 - newGameText.Size.X / 2, _game.Window.ClientBounds.Height / 6 - newGameText.Size.Y / 2); #endregion #region Buttons var backButton = new Button(backButtonTexture, null, hoverBackButtonTexture) { Position = new Vector2(25, 25), Text = "" }; backButton.Click += backButton_Click; var saveOneButton = new Button(buttonTexture, buttonFont, hoverButtonTexture, Color.White) { Position = new Vector2(_game.Window.ClientBounds.Width / 2 - buttonTexture.Width / 2, _game.Window.ClientBounds.Height / 3), Text = System.IO.Directory.Exists("saves/save1/game") ? "Ongoing Game" : "New Game" }; saveOneButton.Click += SaveOneButton_Click; var saveTwoButton = new Button(buttonTexture, buttonFont, hoverButtonTexture, Color.White) { Position = new Vector2(_game.Window.ClientBounds.Width / 2 - buttonTexture.Width / 2, _game.Window.ClientBounds.Height / 3 + buttonTexture.Height * 2.0f), Text = System.IO.Directory.Exists("saves/save2/game") ? "Ongoing Game" : "New Game" }; saveTwoButton.Click += SaveTwoButton_Click; var saveThreeButton = new Button(buttonTexture, buttonFont, hoverButtonTexture, Color.White) { Position = new Vector2(_game.Window.ClientBounds.Width / 2 - buttonTexture.Width / 2, _game.Window.ClientBounds.Height / 3 + buttonTexture.Height * 4.0f), Text = System.IO.Directory.Exists("saves/save3/game") ? "Ongoing Game" : "New Game" }; saveThreeButton.Click += SaveThreeButton_Click; #endregion Components = new List <Component>() { menuBackground, backButton, newGameText, saveOneButton, saveTwoButton, saveThreeButton }; startButtons = new Dictionary <int, Button>(); startButtons.Add(1, saveOneButton); startButtons.Add(2, saveTwoButton); startButtons.Add(3, saveThreeButton); this.backButton = backButton; }
public PNGExporter(FontLoader fontLoader) : base() { _fontLoader = fontLoader; _fontLoader.LoadFont(); }