- XNA 4.0 Game Development by Example Beginner's Guide(Visual Basic Edition)
- Kurt Jaegers
- 166字
- 2021-08-20 15:50:41
Time for action – drawing the screen – the title screen
- Modify the
Draw()
method ofGame1
to include the code necessary to draw the game's title screen afterGraphicsDevice.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
- 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. - Stop the game by pressing Alt + F4.
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.
推薦閱讀
- 同步:秩序如何從混沌中涌現(xiàn)
- Access 2016數(shù)據(jù)庫教程(微課版·第2版)
- Greenplum:從大數(shù)據(jù)戰(zhàn)略到實現(xiàn)
- Creating Mobile Apps with Sencha Touch 2
- Learning Spring Boot
- 深入淺出MySQL:數(shù)據(jù)庫開發(fā)、優(yōu)化與管理維護(第2版)
- Dependency Injection with AngularJS
- 大數(shù)據(jù)架構和算法實現(xiàn)之路:電商系統(tǒng)的技術實戰(zhàn)
- 大數(shù)據(jù)精準挖掘
- 大數(shù)據(jù)數(shù)學基礎(Python語言描述)
- MySQL數(shù)據(jù)庫技術與應用
- 云計算寶典:技術與實踐
- 數(shù)據(jù)中心經(jīng)營之道
- 企業(yè)級大數(shù)據(jù)項目實戰(zhàn):用戶搜索行為分析系統(tǒng)從0到1
- 大數(shù)據(jù)技術體系詳解:原理、架構與實踐