- 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.
推薦閱讀
- 算法競賽入門經(jīng)典:習(xí)題與解答
- 輕松學(xué)大數(shù)據(jù)挖掘:算法、場景與數(shù)據(jù)產(chǎn)品
- 大數(shù)據(jù):從概念到運(yùn)營
- 智能數(shù)據(jù)時(shí)代:企業(yè)大數(shù)據(jù)戰(zhàn)略與實(shí)戰(zhàn)
- SQL應(yīng)用及誤區(qū)分析
- 達(dá)夢數(shù)據(jù)庫運(yùn)維實(shí)戰(zhàn)
- 數(shù)據(jù)庫原理與應(yīng)用
- 數(shù)字IC設(shè)計(jì)入門(微課視頻版)
- SIEMENS數(shù)控技術(shù)應(yīng)用工程師:SINUMERIK 840D-810D數(shù)控系統(tǒng)功能應(yīng)用與維修調(diào)整教程
- Gideros Mobile Game Development
- 數(shù)據(jù)中臺實(shí)戰(zhàn):手把手教你搭建數(shù)據(jù)中臺
- Kubernetes快速進(jìn)階與實(shí)戰(zhàn)
- NoSQL數(shù)據(jù)庫原理(第2版·微課版)
- Configuration Management with Chef-Solo
- 達(dá)夢數(shù)據(jù)庫集群