当前位置: 首页>>代码示例>>C#>>正文


C# ContentManager.LoadImage方法代码示例

本文整理汇总了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;
        }
开发者ID:Cheezmeister,项目名称:Chromathud,代码行数:49,代码来源:Block.cs


注:本文中的Microsoft.Xna.Framework.Content.ContentManager.LoadImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。