这样添加资源有什么问题?
//App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="MediaPath" value="..\..\..\Media\Blockers\" />
</appSettings>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="MediaPath" value="..\..\..\Media\Blockers\" />
</appSettings>
</configuration>
//主程序
namespace myBlockers
{
public class GameEngine : IFrameworkCallback,IDeviceCreation
{
//....
public static readonly string MediaPath = ConfigurationManager.AppSettings.Get("MediaPath");
//The information for the mesh that will display the level
private Mesh levelMesh = null;
private Texture[] levelTextures = null;
private void OnCreateDevice(object sender, DeviceEventArgs e)
{
SurfaceDescription desc = e.BackBufferDescription;
// Create the mesh for the level
ExtendedMaterial[] mtrls;
levelMesh = Mesh.FromFile(MediaPath + "level.x", MeshFlags.Managed, e.Device, out mtrls);
// Store the materials for later use, and create the textures
if ((mtrls != null) && (mtrls.Length > 0))
{
levelTextures = new Texture[mtrls.Length];
for (int i = 0; i < mtrls.Length; i++)
{
// Create the texture
levelTextures[i] = TextureLoader.FromFile(sampleFramework.Device, MediaPath +
mtrls[i].TextureFilename);
}
}
}
private void OnDestroyDevice(object sender, EventArgs e)
{
// Clean up the textures used for the mesh level
if ((levelTextures != null) && (levelTextures.Length > 0))
{
for (int i = 0; i < levelTextures.Length; i++)
{
levelTextures[i].Dispose();
}
// Clean up the mesh level itself
levelMesh.Dispose();
}
}
//...
}
}
...全文
相关推荐
gulprev2给资源文件添加文件指纹
给资源文件添加文件指纹 a.png → a-f7ee61d96b.png 或 a.png → a.png?_v_=f7ee61d96b
openlayers3添加各种地图资源
webgis开发,文件里包含用openlayers3加载百度地图、天地图、高德地图、google地图等源代码,很全很实用。
HTML页面自动清理js、css文件的缓存(自动添加版本号)
在web项目开发过程中,我们经常会引用css、js文件,更新文件后常出现缓存问题(明明更改了代码,在浏览器上访问的时候却没有发生变化),这种情况我们通常采用以下两种解决方案: 1、手动清除浏览器缓存 2、添加版本号(如 layout.css?v=1) 个人认为方法2更快,因为清除浏览器缓存还要等浏览器响应。但是每次更改版本号也很麻烦,所以需要想办法自动添加版本号, 以下是本人收集的方法: 方法一:可以通过js自动给html添加版本号 [removed] [removed]("<link rel='stylesheet' type='te
基于vue打包后字体和图片资源失效问题的解决方法
下面小编就为大家分享一篇基于vue打包后字体和图片资源失效问题的解决方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
jupyter notebook 添加kernel permission denied的操作
主要介绍了jupyter notebook 添加kernel permission denied的操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧


