本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Texture2D.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# Texture2D.ToList方法的具体用法?C# Texture2D.ToList怎么用?C# Texture2D.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.Texture2D
的用法示例。
在下文中一共展示了Texture2D.ToList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
/// <summary>
/// Allows the game component to perform any initialization it needs to before starting
/// to run. This is where it can query for any required services and load content.
/// </summary>
public void Initialize()
{
//RenderTarget = RenderTargetUtils.CreateRenderTarget(game.GraphicsDevice, 1, SurfaceFormat.Color, 800, 600);
/** Load the terrain effect **/
effect = GameFacade.Game.Content.Load<Effect>("Effects/TerrainSplat");
/** Setup **/
//SetCity("0020");
SetCity("0013");
//transX = -(City.Width * Geom.CellWidth / 2);
//transY = +(City.Height / 2 * Geom.CellHeight / 2);
/**
* Setup terrain texture
*/
var device = GameFacade.GraphicsDevice;
var textureBase = GameFacade.GameFilePath("gamedata/terrain/newformat/");
var grass = Texture2D.FromFile(device, Path.Combine(textureBase, "gr.tga"));
var rock = Texture2D.FromFile(device, Path.Combine(textureBase, "rk.tga"));
var snow = Texture2D.FromFile(device, Path.Combine(textureBase, "sn.tga"));
var sand = Texture2D.FromFile(device, Path.Combine(textureBase, "sd.tga"));
var water = Texture2D.FromFile(device, Path.Combine(textureBase, "wt.tga"));
TextureTerrain = TextureUtils.MergeHorizontal(device, grass, snow, sand, rock, water);
TextureGrass = grass;
TextureSand = sand;
TextureSnow = snow;
TextureRock = rock;
TextureWater = water;
effect.Parameters["xTextureBlend"].SetValue(TextureBlend);
effect.Parameters["xTextureTerrain"].SetValue(TextureTerrain);
/** Dont need these anymore **/
//grass.Dispose();
//rock.Dispose();
//snow.Dispose();
//sand.Dispose();
//water.Dispose();
/**
* Setup alpha map texture
*/
/** Construct a single texture out of the alpha maps **/
Texture2D[] alphaMaps = new Texture2D[15];
for (var t = 0; t < 15; t++)
{
var index = t.ToString();
if (t < 10) { index = "0" + index; }
alphaMaps[t] = Texture2D.FromFile(device, Path.Combine(textureBase, "transb" + index + "b.tga"));
}
/** We add an extra 64px so that the last slot in the sheet is a solid color aka no blending **/
TextureBlend = TextureUtils.MergeHorizontal(device, 64, alphaMaps);
alphaMaps.ToList().ForEach(x => x.Dispose());
effect.Parameters["xTextureBlend"].SetValue(TextureBlend);
effect.Parameters["xTextureTerrain"].SetValue(TextureTerrain);
//TextureBlend.Save(@"C:\Users\Admin\Desktop\blendBB.jpg", ImageFileFormat.Jpg);
}
示例2: Initialize
//.........这里部分代码省略.........
case "Zavadaville":
SetCity("0012");
break;
case "Queen Margaret's":
SetCity("0013");
break;
case "Shannopolis":
SetCity("0014");
break;
case "Grantley Grove":
SetCity("0015");
break;
case "Calvin's Creek":
SetCity("0016");
break;
case "The Billabong":
SetCity("0017");
break;
case "Mount Fuji":
SetCity("0018");
break;
case "Dan's Grove":
SetCity("0019");
break;
case "Jolly Pines":
SetCity("0020");
break;
case "Yatesport":
SetCity("0021");
break;
case "Landry Lakes":
SetCity("0022");
break;
case "Nichol's Notch":
SetCity("0023");
break;
case "King Canyons":
SetCity("0024");
break;
case "Virginia Islands":
SetCity("0025");
break;
case "Pixie Point":
SetCity("0026");
break;
case "West Darrington":
SetCity("0027");
break;
case "Upper Shankelston":
SetCity("0028");
break;
case "Albertstown":
SetCity("0029");
break;
case "Terra Tablante":
SetCity("0030");
break;
default:
SetCity("0001");
break;
}
/**
* Setup terrain texture
*/
var device = GameFacade.GraphicsDevice;
var textureBase = GameFacade.GameFilePath("gamedata/terrain/newformat/");
var grass = Texture2D.FromFile(device, Path.Combine(textureBase, "gr.tga"));
var rock = Texture2D.FromFile(device, Path.Combine(textureBase, "rk.tga"));
var snow = Texture2D.FromFile(device, Path.Combine(textureBase, "sn.tga"));
var sand = Texture2D.FromFile(device, Path.Combine(textureBase, "sd.tga"));
var water = Texture2D.FromFile(device, Path.Combine(textureBase, "wt.tga"));
TextureTerrain = TextureUtils.MergeHorizontal(device, grass, snow, sand, rock, water);
TextureGrass = grass;
TextureSand = sand;
TextureSnow = snow;
TextureRock = rock;
TextureWater = water;
/**
* Setup alpha map texture
*/
/** Construct a single texture out of the alpha maps **/
Texture2D[] alphaMaps = new Texture2D[15];
for (var t = 0; t < 15; t++)
{
var index = t.ToString();
if (t < 10) { index = "0" + index; }
alphaMaps[t] = Texture2D.FromFile(device, Path.Combine(textureBase, "transb" + index + "b.tga"));
}
/** We add an extra 64px so that the last slot in the sheet is a solid color aka no blending **/
TextureBlend = TextureUtils.MergeHorizontal(device, 64, alphaMaps);
alphaMaps.ToList().ForEach(x => x.Dispose());
}