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

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.

主站蜘蛛池模板: 鹿泉市| 施甸县| 澄城县| 宝兴县| 兴仁县| 宁强县| 铁岭市| 饶河县| 栾川县| 云安县| 凤山县| 罗城| 泽普县| 南丹县| 峡江县| 礼泉县| 灌南县| 广水市| 柏乡县| 日照市| 台湾省| 永吉县| 阳信县| 和田市| 新建县| 聂拉木县| 尤溪县| 中江县| 丘北县| 大英县| 梨树县| 扎兰屯市| 海南省| 治县。| 上思县| 黄浦区| 泊头市| 昔阳县| 太谷县| 黑水县| 神农架林区|