- XNA 4 3D Game Development by Example:Beginner's Guide
- Kurt Jaegers
- 238字
- 2021-08-05 18:55:25
The Game1 constructor
The Game1
class has a simple constructor with no parameters. An instance of this class will be created by the shell contained in the Program.cs
file within the project when the game is launched.
Tip
The Program.cs file
When your XNA game starts, the Main()
method in the Program.cs
file is what actually gets executed. This method creates an instance of your Game1
class and calls the Run()
method, which performs the initialization we will discuss shortly. It then begins executing the game loop, updating and drawing your game repeatedly until the program exits. In many games, we will not have to worry about Program.cs
, but there are some instances (combining XNA and Windows Forms, for example) when it is necessary to make changes here.
By default, the constructor has created an instance of the GraphicsDeviceManager
class to store in the graphics
member, and has established the base directory for the Content
object, which is an instance of the ContentManager
class.
When we build our project, all of the items in the content project are translated into a format specific to XNA, with the .xnb
file extension. These are then copied to the Content
folder in the same directory as our game's executable file.
Our Speller game will not need to make any changes to the class constructor, so we will simply move on to the next method that is called when our game starts.
- Greenplum:從大數(shù)據(jù)戰(zhàn)略到實現(xiàn)
- PySpark大數(shù)據(jù)分析與應(yīng)用
- 智能數(shù)據(jù)分析:入門、實戰(zhàn)與平臺構(gòu)建
- 數(shù)字媒體交互設(shè)計(初級):Web產(chǎn)品交互設(shè)計方法與案例
- 云數(shù)據(jù)中心網(wǎng)絡(luò)與SDN:技術(shù)架構(gòu)與實現(xiàn)
- 一本書講透Elasticsearch:原理、進階與工程實踐
- 區(qū)塊鏈技術(shù)應(yīng)用與實踐案例
- MySQL技術(shù)內(nèi)幕:SQL編程
- MySQL DBA修煉之道
- 貫通SQL Server 2008數(shù)據(jù)庫系統(tǒng)開發(fā)
- 云計算寶典:技術(shù)與實踐
- Hands-On System Programming with C++
- 數(shù)據(jù)庫查詢優(yōu)化器的藝術(shù):原理解析與SQL性能優(yōu)化
- PostgreSQL高可用實戰(zhàn)
- 掌中寶:電腦綜合應(yīng)用技巧