public HighscoreScreen(ContentManager content, EventHandler theScreenEvent, Game1 game) : base(theScreenEvent) { mHighscoreScreenBackground = content.Load<Texture2D>("Images/Highscore"); _game = game; rowBars = new Texture2D(game.GraphicsDevice, 1, 1); rowBars.SetData<Color>(colorData); bigText = content.Load<SpriteFont>(@"Fonts/General"); normalText = content.Load<SpriteFont>(@"Fonts/SpriteFont1"); //Loads up all the highscores in the save file. if (File.Exists(HighScores.fileName)) { highScoreData = HighScores.LoadHighScores(HighScores.fileName); } }
/// <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> protected override void Initialize() { spriteBatch = new SpriteBatch(GraphicsDevice); Services.AddService(typeof(SpriteBatch), spriteBatch); sounds = new Sounds(); smallText = Content.Load<SpriteFont>(@"Fonts/SpriteFont1"); if (!File.Exists(HighScores.fileName)) { //Make a new one with a few dummy scores in. HighScores.HighScoreData data = new HighScores.HighScoreData(1); data.playerName[0] = "aaa"; data.level[0] = 1; data.score[0] = 0; HighScores.WriteHighscoresToFile(data, HighScores.fileName); } Sounds.SoundBank.PlayCue("MainMusic"); base.Initialize(); }