Windows Phone 7 xNa game Structure Analysis

Source: Internet
Author: User

I. Key classes in xNa

Graphicsdevicemanager class: Provides developers with a way to access graphics devices on PCs, Xbox 360, or Windows Phone 7. The graphicdevice attribute of graphicsdevicemanager represents the actual graph device on the machine. Graphics Device objects play an intermediary role between xNa games and graphics cards (or, more accurately, GPUs on graphics cards, everything xNa games do on the screen must be executed through this object. Simply put, an interface on the video card is called. Note: The GPU is short for graphics processing unit. The spritebatch class is used to draw core objects of Sprite. In terms of computer graphics, the genie is defined as a 2D or 3d11 image integrated into a large scenario. A 2D game is accomplished by drawing a variety of genie (player genie, enemy genie, background genie, and so on) in a scenario. Draw a game screen through the draw () method in the spritebatch object. 2. Method: initialize method: used to initialize variables and other objects related to game1 (game) objects. The graphic device object will be instantiated here, and other objects can be initialized according to the settings of the graphic device object in the initialize method. Loadcontent method: function: The loadcontent method loads all the graphics and other content required by the game, including images, models, and sound effects. This method is called after the initialize method, and is also called when you need to reload the game's graphic content (for example, the graphics device is reset because the player changes the display settings ). After the loadcontent method is called, The game1 object enters the game loop. The loadcontent () method is called only once in a game. Update method: function: simply put, is it to modify the current image based on the image, mainly used to execute some logic design of the game. For example, refresh the page, check for collisions, and update scores. Draw () method: function: equivalent to the paint () or onpaint () method in Windows programming. Diagram of the call to run the preceding method:

The above part is taken from xNa 4.0 Learning Guide

(All Rights Reserved. For details, refer to the source)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.