官术网_书友最值得收藏!

Time for action – drawing the screen – the title screen

  1. Modify the Draw() method of Game1 to include the code necessary to draw the game's title screen after GraphicsDevice.Clear(Color.CornflowerBlue):
    If gameState = GameStates.TitleScreen Then
      spriteBatch.Begin()
      spriteBatch.Draw(titleScreen,New Rectangle(0, 0,Me.Window.ClientBounds.Width,Me.Window.ClientBounds.Height),
        Color.White)
      spriteBatch.End()
    End If
  2. Run the game and verify that the title screen is displayed. You will not be able to start the game yet, however, as we have not written the Update() method yet.
  3. Stop the game by pressing Alt + F4.
    Time for action – drawing the screen – the title screen

What just happened?

The title screen is drawn with a single call to the Draw() method of the spriteBatch object. Since the title screen will cover the entire display, a rectangle is created that is equal to the width and height of the game window.

The Draw() method – the play screen

Finally, we are ready to display the playing pieces on the screen. We will accomplish this by using a simple loop to display all of the playing pieces in the _gameBoard object.

主站蜘蛛池模板: 锦屏县| 凯里市| 汝南县| 连城县| 岚皋县| 茌平县| 泌阳县| 桃源县| 道孚县| 青龙| 河北区| 康平县| 霍城县| 平远县| 祁阳县| 满洲里市| 陵川县| 贺兰县| 玉山县| 镇原县| 博兴县| 太和县| 明星| 九龙县| 正阳县| 二手房| 罗源县| 宜君县| 砀山县| 驻马店市| 雷山县| 香河县| 台安县| 卢湾区| 东阿县| 济源市| 高密市| 青神县| 松桃| 思茅市| 鄯善县|