XNA系列(1)
来源:互联网 发布:js string常用方法 编辑:程序博客网 时间:2024/04/27 01:09
Demonstrates how to add a texture asset to your game. The same procedure can also be applied to model and sound assets. It is assumed that an existing Windows, Xbox 360, or Zune game project is loaded in XNA Game Studio.
There are two ways to add a texture asset to your game, either by adding the asset file or by adding a link to the asset.
我们想建立游戏,首先可能会需要一些素材,这部分内容就是关于如何添加素材的.添加素材有两种方式:
1.添加素材文件
2.添加素材链接
Adding an existing asset to your project is quite different from adding an existing item as a link to your project. The first method creats a copy of the asset file and adds the copy to your project. Adding an asset as a link stores only the path to the asset file.
注意:添加素材文件和添加素材链接是不一样的,前者将素材内容拷贝到Project中,后者只是维护一个指向素材的路径。
Adding the Texture Asset to the Game Project
When you add a game asset (not as a link), XNA Game Studio makes a copy of the asset file and adds the copy to the content project. For this reason, adding a game asset in this manner may be most appropriate when the asset is used by only one developer in one project and is NOT expected to be changed.
如果一个素材不需要改变而且只是针对一个开发者时,一般我们可以直接添加素材文件到Project中。
To add the texture asset to the game project
From the Solution Explorer window, right-click the Content node, click Add, and then click Existing Item.
Navigate to the location of the texture, and select it.
For this example, the asset is called B1_nebula01.tga.
Click the Add button.
This creates a copy of the selected asset in your project.
Save the solution.
Adding the Texture Asset as a Link to the Game Project
Adding an asset as a link is useful if the referenced asset depends on additional external assets. It ensures that the solution always uses the latest version. For this reason, adding a game asset as a link may be most appropriate when the asset is shared with other people or other game projects, or is likely to be changed.
To add the texture asset as a link to the game project
From the Solution Explorer window, right-click the Content node, click Add, and then click Existing Item.
Navigate to the location of the texture, and select it.
For this example, the asset is called B1_nebula01.tga.
Click the small arrow to the right of the Add button, and then click Add as Link.
This creates a reference to the selected asset (and not a copy) in your project.
Save the solution.
添加文件和文件链接的不同就在Add button的行为选择。
Verifying the Content Importer
You should use this procedure each time you add a game asset. This ensures that the asset will be correctly recognized and processed by the Content Pipeline.
每次添加素材都要确认一下Content Pipeline,就是说需要确认该素材可以被XNA正确有效的加载。
To verify the game asset will use the correct content importer
After you add the asset to the solution, open the Properties window to verify that you specified the correct importer and processor.
To verify, right-click on the file in Solution Explorer, and then, from the context menu, click Properties.
For this example, the Content Importer is Texture - XNA Framework and the Content Processor is Texture - XNA Framework.
For more information on the Properties window of a game asset, see Game Asset Properties.
Save the solution.
主要检查:Content Importer和Content Processor
- XNA系列(1)
- XNA高级编程读书笔记系列(1)
- XNA系列(2)
- XNA系列(3)
- XNA系列(4)
- XNA系列(5)
- Shader教程系列XNA
- XNA系列教程 2D 碰撞教程 1: 矩形检测
- XNA 学习-1
- XNA学习笔记1
- XNA
- XNA
- XNA高级编程读书笔记系列(2)
- Chapter 1(1): Introducing XNA
- XNA系列教程 2D碰撞教程2:像素检测
- XNA系列—3d模型的导入
- XNA Game Engine教程系列2- Engine, Content和Services
- Chapter 1(3):Notes about XNA
- pop收邮件
- 程序员的十层楼(4~5层) -- 不为追求,只为创造幸福生活
- 系统程序员成长计划-并发(四)(上)
- 定制操作系统:开始篇——开始了
- 程序员
- XNA系列(1)
- SQL注入 小问题大隐患
- TL-WR541G+ 、无线路由器设置详解、无线路由器设置教程
- pack/unpack 的摸板字符字符 含义
- 学习篇——纸上谈兵2:Linux的XServer
- 课程设计 通讯录源代码
- 学习篇——纸上谈兵3:Linux的XServer续一
- 学习篇——纸上谈兵4:Linux的XServer续二:OpenGL和Clutter
- 注释==代码臭味