- 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.
推薦閱讀
- GitHub Essentials
- Greenplum:從大數據戰略到實現
- Python廣告數據挖掘與分析實戰
- R數據科學實戰:工具詳解與案例分析(鮮讀版)
- Sybase數據庫在UNIX、Windows上的實施和管理
- 數據革命:大數據價值實現方法、技術與案例
- 中國數字流域
- 數據庫技術及應用教程
- 企業級容器云架構開發指南
- INSTANT Android Fragmentation Management How-to
- Hadoop大數據開發案例教程與項目實戰(在線實驗+在線自測)
- SAS金融數據挖掘與建模:系統方法與案例解析
- R Object-oriented Programming
- Unreal Engine Virtual Reality Quick Start Guide
- 數據庫應用系統技術