コード例 #1
0
 protected void Pick(MouseOverList mouseOverList, VertexPositionNormalTextureHue[] vertexBuffer)
 {
     if ((mouseOverList.PickType & PickType) == PickType)
     {
         if (((!DrawFlip) && mouseOverList.IsMouseInObject(vertexBuffer[0].Position, vertexBuffer[3].Position)) ||
             ((DrawFlip) && mouseOverList.IsMouseInObject(vertexBuffer[2].Position, vertexBuffer[1].Position)))
         {
             MouseOverItem item;
             if (!DrawFlip)
             {
                 item          = new MouseOverItem(DrawTexture, vertexBuffer[0].Position, Entity);
                 item.Vertices = new Vector3[4] {
                     vertexBuffer[0].Position, vertexBuffer[1].Position, vertexBuffer[2].Position, vertexBuffer[3].Position
                 };
             }
             else
             {
                 item          = new MouseOverItem(DrawTexture, vertexBuffer[2].Position, Entity);
                 item.Vertices = new Vector3[4] {
                     vertexBuffer[2].Position, vertexBuffer[0].Position, vertexBuffer[3].Position, vertexBuffer[1].Position
                 };
             }
             mouseOverList.Add2DItem(item);
         }
     }
 }
コード例 #2
0
ファイル: GroundView.cs プロジェクト: InjectionDev/UltimaXNA
        private bool Draw3DStretched(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
        {
            // this is an isometric stretched tile and needs a specialized draw routine.
            m_vertexBufferAlternate[0].Position = drawPosition + m_vertex0_yOffset;
            m_vertexBufferAlternate[1].Position = drawPosition + m_vertex1_yOffset;
            m_vertexBufferAlternate[2].Position = drawPosition + m_vertex2_yOffset;
            m_vertexBufferAlternate[3].Position = drawPosition + m_vertex3_yOffset;

            if (!spriteBatch.Draw(DrawTexture, m_vertexBufferAlternate, s_Technique))
            {
                return(false);
            }

            if ((mouseOverList.PickType & PickType) == PickType)
            {
                if (mouseOverList.IsMouseInObjectIsometric(m_vertexBufferAlternate))
                {
                    MouseOverItem item = new MouseOverItem(DrawTexture, m_vertexBufferAlternate[0].Position, Entity);
                    item.Vertices = new Vector3[4] {
                        m_vertexBufferAlternate[0].Position, m_vertexBufferAlternate[1].Position, m_vertexBufferAlternate[2].Position, m_vertexBufferAlternate[3].Position
                    };
                    mouseOverList.Add2DItem(item);
                }
            }

            return(true);
        }
コード例 #3
0
ファイル: GroundView.cs プロジェクト: msx752/UltimaXNA
        private bool Draw3DStretched(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
        {
            // this is an isometric stretched tile and needs a specialized draw routine.
            m_vertexBufferAlternate[0].Position = drawPosition + m_vertex0_yOffset;
            m_vertexBufferAlternate[1].Position = drawPosition + m_vertex1_yOffset;
            m_vertexBufferAlternate[2].Position = drawPosition + m_vertex2_yOffset;
            m_vertexBufferAlternate[3].Position = drawPosition + m_vertex3_yOffset;

            if (!spriteBatch.DrawSprite(DrawTexture, m_vertexBufferAlternate, s_Technique))
                return false;

            if ((mouseOverList.PickType & PickType) == PickType)
            {
                if (mouseOverList.IsMouseInObjectIsometric(m_vertexBufferAlternate))
                {
                    MouseOverItem item = new MouseOverItem(DrawTexture, m_vertexBufferAlternate[0].Position, Entity);
                    item.Vertices = new Vector3[4] { m_vertexBufferAlternate[0].Position, m_vertexBufferAlternate[1].Position, m_vertexBufferAlternate[2].Position, m_vertexBufferAlternate[3].Position };
                    mouseOverList.Add2DItem(item);
                }
            }

            return true;
        }
コード例 #4
0
ファイル: AEntityView.cs プロジェクト: msx752/UltimaXNA
 protected void Pick(MouseOverList mouseOverList, VertexPositionNormalTextureHue[] vertexBuffer)
 {
     if ((mouseOverList.PickType & PickType) == PickType)
     {
         if (((!DrawFlip) && mouseOverList.IsMouseInObject(vertexBuffer[0].Position, vertexBuffer[3].Position)) ||
             ((DrawFlip) && mouseOverList.IsMouseInObject(vertexBuffer[2].Position, vertexBuffer[1].Position)))
         {
             MouseOverItem item;
             if (!DrawFlip)
             {
                 item = new MouseOverItem(DrawTexture, vertexBuffer[0].Position, Entity);
                 item.Vertices = new Vector3[4] { vertexBuffer[0].Position, vertexBuffer[1].Position, vertexBuffer[2].Position, vertexBuffer[3].Position };
             }
             else
             {
                 item = new MouseOverItem(DrawTexture, vertexBuffer[2].Position, Entity);
                 item.Vertices = new Vector3[4] { vertexBuffer[2].Position, vertexBuffer[0].Position, vertexBuffer[3].Position, vertexBuffer[1].Position };
                 item.FlippedTexture = true;
             }
             mouseOverList.Add2DItem(item);
         }
     }
 }
コード例 #5
0
        private bool Draw3DStretched(SpriteBatch3D sb, Vector3 drawPosition, MouseOverList molist, PickTypes pickType, int maxAlt)
        {
            // this is an isometric stretched tile and needs a specialized draw routine.
            _vertexBufferAlternate[0].Position = drawPosition + _vertex0_yOffset;
            _vertexBufferAlternate[1].Position = drawPosition + _vertex1_yOffset;
            _vertexBufferAlternate[2].Position = drawPosition + _vertex2_yOffset;
            _vertexBufferAlternate[3].Position = drawPosition + _vertex3_yOffset;

            if (!sb.Draw(_draw_texture, _vertexBufferAlternate))
                return false;

            if ((pickType & _pickType) == _pickType)
                if (molist.IsMouseInObjectIsometric(_vertexBufferAlternate))
                {
                    MouseOverItem item = new MouseOverItem(_draw_texture, _vertexBufferAlternate[0].Position, this);
                    item.Vertices = new Vector3[4] { _vertexBufferAlternate[0].Position, _vertexBufferAlternate[1].Position, _vertexBufferAlternate[2].Position, _vertexBufferAlternate[3].Position };
                    molist.Add2DItem(item);
                }

            return true;
        }
コード例 #6
0
ファイル: MapObject.cs プロジェクト: FreeReign/UltimaXNA
        internal virtual bool Draw(SpriteBatch3D sb, Vector3 drawPosition, MouseOverList molist, PickTypes pickType, int maxAlt)
        {
            VertexPositionNormalTextureHue[] vertexBuffer;

            if (Z >= maxAlt)
                return false;

            if (m_draw_flip)
            {
                // 2   0
                // |\  |
                // |  \|
                // 3   1
                vertexBuffer = VertexPositionNormalTextureHue.PolyBufferFlipped;
                vertexBuffer[0].Position = drawPosition;
                vertexBuffer[0].Position.X += m_draw_X + 44;
                vertexBuffer[0].Position.Y -= m_draw_Y;

                vertexBuffer[1].Position = vertexBuffer[0].Position;
                vertexBuffer[1].Position.Y += m_draw_height;

                vertexBuffer[2].Position = vertexBuffer[0].Position;
                vertexBuffer[2].Position.X -= m_draw_width;

                vertexBuffer[3].Position = vertexBuffer[1].Position;
                vertexBuffer[3].Position.X -= m_draw_width;
            }
            else
            {
                // 0---1
                //    /
                //  /
                // 2---3
                vertexBuffer = VertexPositionNormalTextureHue.PolyBuffer;
                vertexBuffer[0].Position = drawPosition;
                vertexBuffer[0].Position.X -= m_draw_X;
                vertexBuffer[0].Position.Y -= m_draw_Y;

                vertexBuffer[1].Position = vertexBuffer[0].Position;
                vertexBuffer[1].Position.X += m_draw_width;

                vertexBuffer[2].Position = vertexBuffer[0].Position;
                vertexBuffer[2].Position.Y += m_draw_height;

                vertexBuffer[3].Position = vertexBuffer[1].Position;
                vertexBuffer[3].Position.Y += m_draw_height;
            }

            if (vertexBuffer[0].Hue != m_draw_hue)
                vertexBuffer[0].Hue = vertexBuffer[1].Hue = vertexBuffer[2].Hue = vertexBuffer[3].Hue = m_draw_hue;

            if (!sb.Draw(m_draw_texture, vertexBuffer))
            {
                return false;
            }

            if (m_draw_IsometricOverlap)
            {
                drawIsometricOverlap(sb, vertexBuffer, new Vector2(drawPosition.X, drawPosition.Y - (Z * 4)));
            }

            if ((pickType & m_pickType) == m_pickType)
            {
                if (((!m_draw_flip) && molist.IsMouseInObject(vertexBuffer[0].Position, vertexBuffer[3].Position)) ||
                    ((m_draw_flip) && molist.IsMouseInObject(vertexBuffer[2].Position, vertexBuffer[1].Position)))
                {
                    MouseOverItem item;
                    if (!m_draw_flip)
                    {
                        item = new MouseOverItem(m_draw_texture, vertexBuffer[0].Position, this);
                        item.Vertices = new Vector3[4] { vertexBuffer[0].Position, vertexBuffer[1].Position, vertexBuffer[2].Position, vertexBuffer[3].Position };
                    }
                    else
                    {
                        item = new MouseOverItem(m_draw_texture, vertexBuffer[2].Position, this);
                        item.Vertices = new Vector3[4] { vertexBuffer[2].Position, vertexBuffer[0].Position, vertexBuffer[3].Position, vertexBuffer[1].Position };
                    }
                    molist.Add2DItem(item);
                }
            }

            return true;
        }