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

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.

主站蜘蛛池模板: 天台县| 建阳市| 惠东县| 大丰市| 本溪市| 玛曲县| 新平| 太谷县| 高淳县| 金山区| 武汉市| 东方市| 吴川市| 吉首市| 江安县| 衡南县| 永泰县| 怀仁县| 会理县| 志丹县| 新化县| 丰台区| 康乐县| 隆德县| 黄平县| 宜丰县| 吉林市| 梧州市| 法库县| 余庆县| 阜南县| 墨玉县| 讷河市| 鹤山市| 渝中区| 喀喇沁旗| 门源| 浦城县| 大英县| 崇信县| 厦门市|