// Loading the content and setting up said content public void LoadContent(ContentManager Content, GraphicsDevice graphicsDevice) { backgroundManager.LoadContent(Content, graphicsDevice, @"Backgrounds\Clouds\Cloud-Blue-1", @"Backgrounds\Clouds\Cloud-Blue-2"); HeaderFont = Content.Load<SpriteFont>(@"Fonts\StartMenuHeaderFont"); HUDFont = Content.Load<SpriteFont>(@"Fonts\HUDFont"); HeaderPosition = new Vector2(Game1.ViewPortWidth / 2 - (HeaderFont.MeasureString("Levi Challenge").X / 2), Game1.ViewPortHeight / 20); MadeByPosition = new Vector2(10, Game1.ViewPortHeight - HUDFont.MeasureString("Made by Nathan Todd").Y); boxHeaderLine = new GuiBox(new Vector2(Game1.ViewPortWidth / 2 - (float)((HeaderFont.MeasureString("Levi Challenge").X * 1.3) / 2), Game1.ViewPortHeight / 6), (int)(HeaderFont.MeasureString("Levi Challenge").X * 1.3), 2, 0, Color.White * 0.4f, Color.White, graphicsDevice); btnNewGame = new GuiButton(new Vector2(Game1.ViewPortWidth / 2 - 168, Game1.ViewPortHeight / 4), 336, 69, 0, Color.Black * 0.3f, Color.YellowGreen * 0.3f, Color.White, Color.White * 0.6f, "New Game", @"Fonts\StartMenuButtonFont"); btnContinue = new GuiButton(new Vector2(Game1.ViewPortWidth / 2 - 168, Game1.ViewPortHeight / 4 + 69), 336, 69, 0, Color.Black * 0.15f, Color.YellowGreen * 0.15f, Color.White, Color.White * 0.6f, "Continue", @"Fonts\StartMenuButtonFont"); btnOptions = new GuiButton(new Vector2(Game1.ViewPortWidth / 2 - 168, Game1.ViewPortHeight / 4 + 138), 336, 69, 0, Color.Black * 0.3f, Color.YellowGreen * 0.3f, Color.White, Color.White * 0.6f, "Options", @"Fonts\StartMenuButtonFont"); btnExit = new GuiButton(new Vector2(Game1.ViewPortWidth / 2 - 168, Game1.ViewPortHeight / 4 + 207), 336, 69, 0, Color.Black * 0.15f, Color.YellowGreen * 0.15f, Color.White, Color.White * 0.6f, "Exit", @"Fonts\StartMenuButtonFont"); guiSystem.Add(boxHeaderLine); guiSystem.Add(btnNewGame); guiSystem.Add(btnContinue); guiSystem.Add(btnOptions); guiSystem.Add(btnExit); guiSystem.LoadContent(Content, graphicsDevice); guiSystem.ButtonIndexUpdate(0); }
// Loads any content required public void LoadContent(ContentManager content, GraphicsDevice graphicsdevice) { if (TexturePath != null) { Texture = content.Load<Texture2D>(TexturePath); Scale = new Vector2(1, 1); } else myBox = new GuiBox(Position, Width, Height, BWidth, MColor, BColor, graphicsdevice); }
// Loads any content required public void LoadContent(ContentManager content, GraphicsDevice graphicsdevice) { if (TexturePath != null) { Texture = content.Load <Texture2D>(TexturePath); Scale = new Vector2(1, 1); } else { myBox = new GuiBox(Position, Width, Height, BWidth, MColor, BColor, graphicsdevice); } }
public void LoadContent(ContentManager content, GraphicsDevice graphicsdevice) { Font = content.Load<SpriteFont>(FontPath); if (TexturePath != null) { MainTexture = content.Load<Texture2D>(TexturePath); ; CurrentTexture = MainTexture; TextPosition = new Vector2((int)(Position.X + (CurrentTexture.Width / 2) - (Font.MeasureString(Text).X / 2)), (int)(Position.Y + (CurrentTexture.Height / 2) - (Font.MeasureString(Text).Y / 2))); } else { DefaultBox = new GuiBox(Position, Width, Height, BWidth, MColor, BColor, graphicsdevice); TextPosition = new Vector2((int)(Position.X + (Width / 2) - (Font.MeasureString(Text).X / 2)), (int)(Position.Y + (Height / 2) - (Font.MeasureString(Text).Y / 2))); } }
public void LoadContent(ContentManager content, GraphicsDevice graphicsdevice) { Font = content.Load <SpriteFont>(FontPath); if (TexturePath != null) { MainTexture = content.Load <Texture2D>(TexturePath);; CurrentTexture = MainTexture; TextPosition = new Vector2((int)(Position.X + (CurrentTexture.Width / 2) - (Font.MeasureString(Text).X / 2)), (int)(Position.Y + (CurrentTexture.Height / 2) - (Font.MeasureString(Text).Y / 2))); } else { DefaultBox = new GuiBox(Position, Width, Height, BWidth, MColor, BColor, graphicsdevice); TextPosition = new Vector2((int)(Position.X + (Width / 2) - (Font.MeasureString(Text).X / 2)), (int)(Position.Y + (Height / 2) - (Font.MeasureString(Text).Y / 2))); } }
public void LoadContent(ContentManager content, GraphicsDevice graphicsDevice) { txtBoxWaves = new GuiTextBox(new Vector2(Game1.ViewPortWidth - 147, Game1.ViewPortHeight - 39), 137, 29, 1, Color.Black * 0.39f, new Color(98, 0, 0), "Waves: " + SpawnManager.WaveCount, @"Fonts\HUDFont"); boxLifeBars = new GuiBox(new Vector2(10, Game1.ViewPortHeight - 54), 162, 44, 1, Color.Black * 0.39f, new Color(98, 0, 0), graphicsDevice); lfbHealthBar = new GuiLifeBar(new Vector2(28, Game1.ViewPortHeight - 45), playerRef.myShip.Health, @"Sprites\GUI\Health-Bar"); lfbShieldBar = new GuiLifeBar(new Vector2(28, Game1.ViewPortHeight - 29), playerRef.myShip.Shield, @"Sprites\GUI\Shield-Bar"); guiSystem.Add(txtBoxScore); guiSystem.Add(txtBoxFlamoca); guiSystem.Add(txtBoxWaves); guiSystem.Add(boxLifeBars); guiSystem.Add(lfbHealthBar); guiSystem.Add(lfbShieldBar); guiSystem.LoadContent(content, graphicsDevice); }
// The Add function is used for adding any GUI Object to the lists above. public void Add(GuiBox guiBox) { GuiBoxList.Add(guiBox); }