/// <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() { // Instantiate Tetris logic IBoard board = new Board(); Score score = new Score(board); // Add to board's GameOver event board.GameOver += gameOver; // Instantiate sprite classes int size = 25; boardSprite = new BoardSprite(this, board, size); shapeSprite = new ShapeSprite(this, board, score, size); scoreSprite = new ScoreSprite(this, score); // Add sprite classes Components.Add(boardSprite); Components.Add(shapeSprite); Components.Add(scoreSprite); // Set height and width of screen graphics.PreferredBackBufferHeight = 600; graphics.PreferredBackBufferWidth = 500; graphics.ApplyChanges(); // Initialize font font = Content.Load<SpriteFont>("scoreFont"); base.Initialize(); //Create button int x = 5; int y = 200; button_state = BState.UP; button_color = Color.White; button_timer = 0.0; button_rectangle = new Rectangle(x, y, 100, 40); IsMouseVisible = true; background_color = Color.Black; /**Music Song song = Content.Load<Song>("music"); MediaPlayer.Play(song); */ }