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


C# SpriteBatchUI.DrawSprite方法代码示例

本文整理汇总了C#中UltimaXNA.Core.Graphics.SpriteBatchUI.DrawSprite方法的典型用法代码示例。如果您正苦于以下问题:C# SpriteBatchUI.DrawSprite方法的具体用法?C# SpriteBatchUI.DrawSprite怎么用?C# SpriteBatchUI.DrawSprite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UltimaXNA.Core.Graphics.SpriteBatchUI的用法示例。


在下文中一共展示了SpriteBatchUI.DrawSprite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS)
        {
            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(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.DrawSprite(m_GumpTexture, v, Techniques.MiniMap);

            m_TimeMS += (float)frameMS;
            if (m_TimeMS >= ReticleBlinkMS)
            {
                if (m_PlayerIndicator == null)
                {
                    m_PlayerIndicator = new Texture2D(spriteBatch.GraphicsDevice, 1, 1);
                    m_PlayerIndicator.SetData(new uint[1] { 0xFFFFFFFF });
                }
                spriteBatch.Draw2D(m_PlayerIndicator, new Vector3(position.X + Width / 2, position.Y + Height / 2 - 8, 0), Vector3.Zero);
            }
            if (m_TimeMS >= ReticleBlinkMS * 2)
            {
                m_TimeMS -= ReticleBlinkMS * 2;
            }
        }
开发者ID:jorsi,项目名称:UltimaXNA,代码行数:34,代码来源:MiniMapGump.cs


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