本文整理汇总了C#中Microsoft.Xna.Framework.Content.ContentManager.LoadImage方法的典型用法代码示例。如果您正苦于以下问题:C# ContentManager.LoadImage方法的具体用法?C# ContentManager.LoadImage怎么用?C# ContentManager.LoadImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Content.ContentManager
的用法示例。
在下文中一共展示了ContentManager.LoadImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
public static void LoadContent(ContentManager content)
{
//load just one copy of each sprite
sprites = new List<Texture2D>[NUM_FLAVORS];
spritesSelected = new List<Texture2D>[NUM_FLAVORS];
spritesHovered = new List<Texture2D>[NUM_FLAVORS];
for (int i = 0; i < NUM_FLAVORS; ++i)
{
sprites[i] = new List<Texture2D>(NUM_IMAGES);
spritesSelected[i] = new List<Texture2D>(NUM_IMAGES);
spritesHovered[i] = new List<Texture2D>(NUM_IMAGES);
}
//image naming conventions for different flavors
string[] flavors = new string[NUM_FLAVORS];
flavors[FLAVOR_NORMAL] = "";
flavors[FLAVOR_BOMB] = "Bomb";
//Load the dead block sprite, using it for all dead blocks regardless of flavor
for (int i = 0; i < NUM_FLAVORS; ++i)
{
sprites[i].Add(content.LoadImage(style + "Dead"));
spritesSelected[i].Add(sprites[0][0]);
spritesHovered[i].Add(sprites[0][0]);
}
for (int i = 1; i < NUM_IMAGES; ++i)
{
for (int j = 0; j < NUM_FLAVORS; ++j)
{
sprites[j].Add(content.LoadImage(style + i.ToString() + flavors[j]));
spritesSelected[j].Add(content.LoadImage(style + i.ToString() + flavors[j] + "selected2"));
spritesHovered[j].Add(content.LoadImage(style + i.ToString() + flavors[j] + "selected"));
}
}
bombHighlight = content.LoadImage(style + "BombHighlightS");
//colors that roughly correspond to those for each image
colors[0] = Color.Gray;
colors[1] = Color.Red;
colors[2] = Color.HotPink;
colors[3] = Color.Purple;
colors[4] = Color.Blue;
colors[5] = Color.Cyan;
colors[6] = Color.Green;
colors[7] = Color.GreenYellow;
colors[8] = Color.Yellow;
colors[9] = Color.Orange;
}