當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。