Play XNA in Win8 Metro App: Port XNA game to Win8

Source: Internet
Author: User
Ready!

In this article, we will port a WindowsPhoneXNA game to the Win8 Metro (Modern) style, which can be seen directly on the Win8 interface, rather than an exe execution program, this porting process is very easy to use, and porting other more complex games is similar. Of course, if your application uses a large number of platform features, you have to handle and change it on your own. In this article, we have prepared an XNA game example. This game is an example in Microsoft MSDN called ChaseCamera to introduce the camera project, you can go directly to the Microsoft official website download: http://xbox.create.msdn.com/zh-CN/education/catalog/sample/chasecamera

Let's take a look at the running effect on the WP7 simulator:

After the Build is complete, copy or switch to the Windows 8 development environment, and the next step will be used.

In Windows 8

Make sure that you have the VS2012 development environment and create a new MonoGameApplication, choose Create Project> Find the MonoGame template in Visual C # (For details, refer to the previous article "XNA: framework solution in Win8 Metro App"):

Create the Content directory in the project, find the ChaseCamera project directory in the browser, open the bin \ Windows Phone \ Debug or bin \ Windows Phone \ Release directory, you will find the Content directory, open it and place all the files (usually. add all files to the project's Content directory, and change the resource generation operation attribute of all added files to "Content" ("Content ").

Now we need to copy the code file. For example, ChaseCameraGame does not include Game1.cs in ChaseCamera. cs, delete the original Game1.cs, and add the following files to the project:
ChaseCamera. cs
ChaseCameraGame. cs
Ship. cs

These files are actually the main logical code files, but you need to modify them. Delete the program entry points in the original code file first. If you want to change the project, try again.

Then, change the Game to ChaseCameraGame in the original entry point. Pay attention to the namespace.

Someone may ask, is that simple? Yes! It's that simple. Run it.

Success ,. fbx). We just used VS to generate the product. Other methods include xnb generation tools developed by folk experts. However, most of them process a single content, either generate Texture or generate sound, which is not found after mixing. If custom content pipelines are added, the tragedy will occur. Therefore, we need to be patient: xnb files cannot be directly obtained in the development environment of Windows 8. If any of you have a good solution, you must leave it blank...

Download this example: Click here to download

Careful friends will surely find that ChaseCamera actually has a Windows version. After the study is started, the Code is the same as that of WindowsPhone. If you are playing games, it actually supports the keyboard, finally, the XNA game can be successfully transplanted to the Win8 Metro (Modern) style with MonoGame.

Since XNA has been so smoothly running in Win8, so on this third-party XNA engine can play Win8, this is no problem, such as cocos2d-xna, nine engine ...... The next article will introduce the porting of cocos2d-xna running on Win8.

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.