博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
XNA系列(1)
阅读量:5319 次
发布时间:2019-06-14

本文共 3308 字,大约阅读时间需要 11 分钟。

本系列的文章都是从MSDN上找的文章,添加一点学习笔记。
 
XNA Game Studio 3.0
Adding Game Assets to Your Game

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.添加素材链接

Bb313966.note(en-US,XNAGameStudio.30).gifTip

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

  1. From the Solution Explorer window, right-click the Content node, click Add, and then click Existing Item.

  2. Navigate to the location of the texture, and select it.

    For this example, the asset is called B1_nebula01.tga.

  3. Click the Add button.

    This creates a copy of the selected asset in your project.

  4. 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

  1. From the Solution Explorer window, right-click the Content node, click Add, and then click Existing Item.

  2. Navigate to the location of the texture, and select it.

    For this example, the asset is called B1_nebula01.tga.

  3. 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.

  4. 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

  1. After you add the asset to the solution, open the Properties window to verify that you specified the correct importer and processor.

  2. 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 .

  3. Save the solution.

主要检查:Content Importer和Content Processor

转载于:https://www.cnblogs.com/snake-hand/archive/2012/08/12/2635455.html

你可能感兴趣的文章
给C#学习者的建议 - CLR Via C# 读后感
查看>>
Recover Binary Search Tree
查看>>
Java 实践:生产者与消费者
查看>>
[转]IOCP--Socket IO模型终结篇
查看>>
(五)归一化
查看>>
使用信号量
查看>>
实验八 接口与实现接口的类
查看>>
PostgreSQL 保留关键字添加方法之一,不带参数的函数
查看>>
赛前热手 (天梯赛暴力题)
查看>>
【转贴】SAP HANA内存数据库详解
查看>>
两种应该掌握的排序方法--------1.shell Sort
查看>>
vuejs动态组件给子组件传递数据
查看>>
杭电2065(递推)红色病毒
查看>>
js 获取视频的第一帧
查看>>
各种正则验证
查看>>
观察者模式(Observer)
查看>>
python中numpy.r_和numpy.c_
查看>>
WPF简单模拟QQ登录背景动画
查看>>
bzoj 2038 小Z的袜子
查看>>
egret3D与2D混合开发,画布尺寸不一致的问题
查看>>