public void Load(ContentManager content) { lastClickTime = 0; index = 0; isFinished = false; frames = new List<Texture2D>(); string GUIFolder = GraphicSettings.GetGUIFolder(); font = content.Load<SpriteFont>(GUIFolder + "Consolas"); Texture2D buttonTexture = content.Load<Texture2D>(GUIFolder + "InGameButton"); Rectangle r = new Rectangle((int)(GraphicSettings.CenterScreen.X - buttonTexture.Width / 2), GraphicSettings.ScreenBounds.Height - (buttonTexture.Height + 20), buttonTexture.Width, buttonTexture.Height); forwardBt = new Button(r, "Avanti", "ForwardButton"); forwardBt.LoadTextureAndFont(buttonTexture, font); forwardBt.SetTextPosition(); for(int i = 1; i < 7; i++) { frames.Add(content.Load<Texture2D>("Tutorial/" + i.ToString())); } }
/// <summary> /// Carica le texture e il font /// </summary> /// <param name="content"></param> public void Load(Game game) { string GUIFolder = GraphicSettings.GetGUIFolder(); font = game.Content.Load<SpriteFont>(GUIFolder + "Consolas"); buttonTexture = game.Content.Load<Texture2D>(GUIFolder + "InGameButton"); titleTexture = game.Content.Load<Texture2D>(GUIFolder + "TitleLogo"); background = game.Content.Load<Texture2D>(@"Skybox/BackgroundCredits"); GraphicsDevice device = game.GraphicsDevice; int Width = GraphicSettings.ScreenBounds.Width; int Height = GraphicSettings.ScreenBounds.Height; Vector2 buttonDimensions = new Vector2(buttonTexture.Width, buttonTexture.Height); string s = "Torna al menu"; Color[] data = new Color[(int)(buttonDimensions.X * buttonDimensions.Y)]; Texture2D txt = new Texture2D(device, (int)font.MeasureString(s).X + 20, (int)font.MeasureString(s).Y + 20); for (int i = 0; i < data.Length; ++i) data[i] = new Color(64, 64, 128, 255); txt.SetData(data); backButton = new Button(new Rectangle(10, Height - (int)buttonDimensions.Y - 10, (int)buttonDimensions.X, (int)buttonDimensions.Y), "Torna al menu", "MenuButton"); backButton.LoadTextureAndFont(txt, font); backButton.SetTextPosition(); backButton.SetTextColor(Color.Yellow); titlePosition = new Vector2((Width - titleTexture.Width) / 2, Height); textPosition = new Vector2(0, titleTexture.Height + Height); }
public static void Load(Game game) { string GUIFolder = GraphicSettings.GetGUIFolder(); OnScreenButtons = new List<Button>(); spriteBatch = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch)); font = game.Content.Load<SpriteFont>(GUIFolder + "Consolas"); bar = game.Content.Load<Texture2D>(GUIFolder + "Bar"); heart = game.Content.Load<Texture2D>(GUIFolder + "Heart"); power = game.Content.Load<Texture2D>(GUIFolder + "Power"); money = game.Content.Load<Texture2D>(GUIFolder + "Money"); pointedButton = new Button(new Rectangle(), "", "PointedButton"); pointedButton.LoadTextureAndFont(game.Content.Load<Texture2D>(GUIFolder + "InGameButton"), font); OnScreenButtons.Add(new Button(new Rectangle(), "CameraButton")); OnScreenButtons[0].LoadTexture(game.Content.Load<Texture2D>(GUIFolder + "CameraButton")); OnScreenButtons.Add(new Button(new Rectangle(), "PauseButton")); OnScreenButtons[1].LoadTexture(game.Content.Load<Texture2D>(GUIFolder + "PauseButton")); OnScreenButtons.Add(new Button(new Rectangle(), "Torna alla\n galassia", "ReturnToGalaxy")); OnScreenButtons[2].LoadTexture(game.Content.Load<Texture2D>(GUIFolder + "InGameButton")); SetButtonPositions(); }