當前位置: 首頁>>代碼示例>>C#>>正文


C# SpriteBatchUI.Draw方法代碼示例

本文整理匯總了C#中UltimaXNA.Core.Graphics.SpriteBatchUI.Draw方法的典型用法代碼示例。如果您正苦於以下問題:C# SpriteBatchUI.Draw方法的具體用法?C# SpriteBatchUI.Draw怎麽用?C# SpriteBatchUI.Draw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UltimaXNA.Core.Graphics.SpriteBatchUI的用法示例。


在下文中一共展示了SpriteBatchUI.Draw方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Draw

        public override void Draw(SpriteBatchUI spriteBatch, Point position)
        {
            AEntity player = WorldModel.Entities.GetPlayerEntity();
            float x = (float)Math.Round((player.Position.X % 256) + player.Position.X_offset) / 256f;
            float y = (float)Math.Round((player.Position.Y % 256) + player.Position.Y_offset) / 256f;
            Vector3 playerPosition = new Vector3(x - y, x + y, 0f);
            float minimapU = (m_GumpTexture.Width / 256f) / 2f;
            float minimapV = (m_GumpTexture.Height / 256f) / 2f;

            VertexPositionNormalTextureHue[] v = new VertexPositionNormalTextureHue[4]
            {
                new VertexPositionNormalTextureHue(new Vector3(position.X, position.Y, 0), playerPosition + new Vector3(-minimapU, -minimapV, 0), new Vector3(0, 0, 0)),
                new VertexPositionNormalTextureHue(new Vector3(position.X + Width, position.Y, 0), playerPosition + new Vector3(minimapU, -minimapV, 0), new Vector3(1, 0, 0)),
                new VertexPositionNormalTextureHue(new Vector3(position.X, position.Y + Height, 0), playerPosition + new Vector3(-minimapU, minimapV, 0), new Vector3(0, 1, 0)),
                new VertexPositionNormalTextureHue(new Vector3(position.X + Width, position.Y + Height, 0), playerPosition + new Vector3(minimapU, minimapV, 0), new Vector3(1, 1, 0))
            };

            spriteBatch.Draw(m_GumpTexture, v, Techniques.MiniMap);

            if (UltimaGame.TotalMS % 500f < 250f)
            {
                if (m_PlayerIndicator == null)
                {
                    m_PlayerIndicator = new Texture2D(spriteBatch.GraphicsDevice, 1, 1);
                    m_PlayerIndicator.SetData<uint>(new uint[1] { 0xFFFFFFFF });
                }
                spriteBatch.Draw2D(m_PlayerIndicator, new Vector3(position.X + Width / 2, position.Y + Height / 2 - 8, 0), Vector3.Zero);
            }
        }
開發者ID:InjectionDev,項目名稱:UltimaXNA,代碼行數:29,代碼來源:MiniMapGump.cs


注:本文中的UltimaXNA.Core.Graphics.SpriteBatchUI.Draw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。