Abstract: The last time we introduced how to use Visual Studio 2010 or Visual Studio 2010 express for Windows Phone to design an xNa-based Windows Phone 7 game program, learn about the basic architecture and core functions of xNa-based game programs. In this case, we will introduce you to the important categories that xNa framework supports game program production as the basic knowledge for developing game programs. In addition, we will also use the categories described in this article to implement a simple game program and make it have a background pattern that can be continuously rolled up. Graphicsdevicemanager the first class to be introduced is the graphicsdevicemanager class responsible for managing the drawing device. XNa-based game programs must create graphicsdevicemanager objects during initialization, and set necessary properties including the game program window height and width as the basis for displaying game content. For details about how to create graphicsdevicemanager class objects during game initialization, refer to [design xNa-based Windows Phone 7 games. Table 1 shows the common attributes of graphicsdevicemanager: Table 1: common attributes of graphicsdevicemanager categories
Attribute name |
Description |
Isfullscreen |
Controls whether the game program window is displayed in full screen mode |
Preferredbackbufferformat |
Screen buffer format |
Preferredbackbufferheight |
Screen buffer height |
Preferredbackbufferwidth |
Screen buffer width |
For more information about graphicsdevicemanager, see table 2: Table 2: Common graphicsdevicemanager class methods
Method Name |
Description |
Togglefullscreen |
Switch between window mode and full screen mode |
The core category of the game is xNa-based. The main body of the game program is the game category. It is also the basic category of the game1 category as the main body of the game program. Game programs can use the update method of game1 to update the game status and use the draw method to display the game content. Table 3 shows the common attributes of the game category: Table 3: common attributes of game categories
Attribute name |
Description |
Components |
Manage all gamecomponent collections |
Content |
Get the properties of the contentmanager object |
Graphicsdevice |
Get the properties of a graphic device object |
Isactive |
Determine whether the game program's window is currently in effect |
Isfixedtimestep |
Control the use of fixed update mode or variable update mode for game programs |
Targetelapsedtime |
When the content value of the isfixedtimestep attribute is true, the attribute that controls the call frequency of the update Method |
For common methods of game categories, see table 4: Table 4: common methods for game categories
Method Name |
Description |
Exit |
End Game Program Execution |
Begindraw |
Starts to draw a graphic. |
Enddraw |
The action for drawing the image ends. |
Draw |
Execute the action to draw game content |
Loadcontent |
How to load game Resources |
Unloadcontent |
How to release game Resources |
Update |
Method for updating game status |
|
Http://wp.662p.com/thread-8084-1-1.html