Example #1
0
        public override void Draw(SpriteBatch sb)
        {
            float x = m_ScrollPosition;
            float y = m_Rect.Top;

            // Draw Clues
            foreach (Clue c in m_Clues)
            {
                if ((x + m_IconSize) >= 0)
                {
                    // This icon is at least partially visible
                    bool bHintClue = GameScene.ShouldShowHint(c);
                    DrawClue(sb, (int)x, (int)y, c, bHintClue);
                }

                x += m_IconSize + m_ClueSpace;
                if (x > m_Rect.Width)
                {
                    break;  // Cant draw anymore, just skip the rest
                }
            }

            if (m_iSelectedIndex >= 0)
            {
                int xpos = (int)m_ScrollPosition + (m_iSelectedIndex * (m_IconSize + m_ClueSpace) - 3);

                Rectangle rect = new Rectangle(xpos, m_Rect.Top - 3, m_IconSize + 6, (m_IconSize * 3) + 6);
                sb.Draw(Assets.SelectionIconTall, rect, Color.White);
            }

            int clueTotalSpace = (m_Clues.Count * (m_IconSize + m_ClueSpace)) - m_ClueSpace;

            m_bCanScroll = (clueTotalSpace > m_Rect.Width);

            if (m_bCanScroll)
            {
                // Draw left arrow
                if (m_ScrollPosition != m_ScrollMax)
                {
                    sb.Draw(Assets.ScrollArrow, new Rectangle(m_Rect.Left, m_Rect.Top + (m_IconSize * 2), m_IconSize, m_IconSize), null, Color.White, (float)-(Math.PI / 2), new Vector2(0, 0), SpriteEffects.None, 0);
                }

                // Draw right arrow
                if (m_ScrollPosition != m_ScrollMin)
                {
                    sb.Draw(Assets.ScrollArrow, new Rectangle(m_Rect.Right, m_Rect.Top + m_IconSize, m_IconSize, m_IconSize), null, Color.White, (float)-(Math.PI + (Math.PI / 2)), new Vector2(0, 0), SpriteEffects.None, 0);
                }
            }
            else
            {
                m_ScrollPosition = m_Rect.Left;
            }
        }
Example #2
0
        public override void Draw(SpriteBatch sb)
        {
            float x = m_Rect.Left;
            float y = m_ScrollPosition;

            foreach (Clue c in m_Clues)
            {
                if ((y + m_IconSize) >= 0)
                {
                    // This icon is at least partially visible
                    bool bHintClue = GameScene.ShouldShowHint(c);
                    DrawClue(sb, (int)x, (int)y, c, bHintClue);
                }

                y += m_IconSize + m_ClueSpace;
                if (y > m_Rect.Height)
                {
                    break;  // Cant draw anymore, just skip the rest
                }
            }

            if (m_iSelectedIndex >= 0)
            {
                int ypos = (int)m_ScrollPosition + (m_iSelectedIndex * (m_IconSize + m_ClueSpace) - 3);

                Rectangle rect = new Rectangle(m_Rect.Left - 3, ypos, (m_IconSize * 3) + 6, m_IconSize + 6);
                sb.Draw(Assets.SelectionIconWide, rect, Color.White);
            }

            int clueTotalSpace = (m_Clues.Count * (m_IconSize + m_ClueSpace)) - m_ClueSpace;

            m_bCanScroll = (clueTotalSpace > m_Rect.Height);

            if (m_bCanScroll)
            {
                // Draw up arrow
                if (m_ScrollPosition != m_ScrollMax)
                {
                    sb.Draw(Assets.ScrollArrow, new Rectangle(m_Rect.Left + m_IconSize, 0, m_IconSize, m_IconSize), Color.White);
                }

                // Draw down arrow
                if (m_ScrollPosition != m_ScrollMin)
                {
                    sb.Draw(Assets.ScrollArrow, new Rectangle(m_Rect.Left + m_IconSize, m_Rect.Bottom - m_IconSize, m_IconSize, m_IconSize), null, Color.White, 0, Vector2.Zero, SpriteEffects.FlipVertically, 0);
                }
            }
            else
            {
                m_ScrollPosition = m_Rect.Top;
            }
        }