官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 三河市| 西畴县| 贵州省| 武胜县| 尚志市| 图片| 蒙山县| 德兴市| 仲巴县| 巨鹿县| 广德县| 辛集市| 绥芬河市| 崇阳县| 阿坝县| 林芝县| 延川县| 文昌市| 谢通门县| 新乐市| 温宿县| 绵阳市| 清远市| 长沙县| 杨浦区| 长治市| 肇东市| 达拉特旗| 镇赉县| 富川| 亚东县| 东兰县| 定州市| 池州市| 玛纳斯县| 汉寿县| 沛县| 博罗县| 根河市| 乐山市| 甘泉县|