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

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.

主站蜘蛛池模板: 抚松县| 沅江市| 文化| 阳泉市| 乌鲁木齐县| 应用必备| 宜兰县| 汨罗市| 五常市| 西乡县| 项城市| 芷江| 上蔡县| 阜康市| 永新县| 田阳县| 枣强县| 青岛市| 宜君县| 泰州市| 六枝特区| 赤峰市| 遂川县| 得荣县| 晋州市| 兖州市| 澜沧| 平安县| 泾川县| 新源县| 德保县| 浦城县| 永泰县| 霍林郭勒市| 遂溪县| 池州市| 延吉市| 屏东市| 安塞县| 怀宁县| 阿坝|