- 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.
- 漫話大數(shù)據(jù)
- 我們都是數(shù)據(jù)控:用大數(shù)據(jù)改變商業(yè)、生活和思維方式
- Python絕技:運(yùn)用Python成為頂級(jí)數(shù)據(jù)工程師
- 數(shù)據(jù)化網(wǎng)站運(yùn)營(yíng)深度剖析
- 數(shù)據(jù)結(jié)構(gòu)與算法(C語(yǔ)言版)
- 智能數(shù)據(jù)時(shí)代:企業(yè)大數(shù)據(jù)戰(zhàn)略與實(shí)戰(zhàn)
- 網(wǎng)站數(shù)據(jù)庫(kù)技術(shù)
- 大數(shù)據(jù)架構(gòu)商業(yè)之路:從業(yè)務(wù)需求到技術(shù)方案
- 實(shí)用數(shù)據(jù)結(jié)構(gòu)
- 貫通SQL Server 2008數(shù)據(jù)庫(kù)系統(tǒng)開(kāi)發(fā)
- SQL Server 2012實(shí)施與管理實(shí)戰(zhàn)指南
- 大數(shù)據(jù)與機(jī)器學(xué)習(xí):實(shí)踐方法與行業(yè)案例
- 云計(jì)算
- 離線和實(shí)時(shí)大數(shù)據(jù)開(kāi)發(fā)實(shí)戰(zhàn)
- Oracle 11g數(shù)據(jù)庫(kù)管理員指南