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

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.

主站蜘蛛池模板: 五峰| 涿州市| 大港区| 南漳县| 广丰县| 株洲市| 青川县| 宜川县| 丘北县| 南丰县| 日照市| 宣武区| 华阴市| 会东县| 黄陵县| 平度市| 台南县| 万山特区| 芦山县| 广西| 绥芬河市| 玉门市| 当涂县| 永川市| 吴江市| 安西县| 延边| 阿巴嘎旗| 来宾市| 镇江市| 正安县| 巫溪县| 炉霍县| 吴旗县| 阳新县| 通海县| 云林县| 安康市| 甘洛县| 仁怀市| 化州市|