XNA 4.0 Game Development by Example Beginner's Guide(Visual Basic Edition)
上QQ阅读APP看书,第一时间看更新

Time for action – updating the Initialize() method

  1. Update the Initialize() method to include the following:
    Me.IsMouseVisible = True
    Me.graphics.PreferredBackBufferWidth = 800
    Me.graphics.PreferredBackBufferHeight = 600
    graphics.ApplyChanges()
  2. Update the LoadContent() method to include the following after three texture files have been loaded:
    _gameBoard = New GameBoard(playingPieces, EmptyPiece)

What just happened?

After making the mouse cursor visible, we set the size of the BackBuffer to 800x600 pixels. On Windows, this will size the game window to 800x600 pixels as well.

The constructor for the GameBoard class calls the ClearBoard() method, so each of the pieces on the _gameBoard instance will be set to Empty.

The Draw() method – the title screen

In the declarations section, we established two possible game states. The first (and default) state is GameStates.TitleScreen, indicating that the game should not be processing actual game play, but should instead be displaying the game's logo and waiting for the user to begin the game.