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); }