Example #1
0
        void DrawIcons(SpriteBatch sb)
        {
            for (int y = 0; y < GameScene.Puzzle.m_iSize; y++)
            {
                int ycoord = m_Rect.Top + (y * m_iCellHeight);

                for (int x = 0; x < GameScene.Puzzle.m_iSize; x++)
                {
                    int xcoord = m_Rect.Left + (x * m_iCellWidth);


                    int iFinal = GameScene.Puzzle.m_Rows[y].m_Cells[x].m_iFinalIcon;
                    if (iFinal >= 0)
                    {
                        Rectangle r = m_FinalRect;
                        r.Offset(xcoord, ycoord);
                        bool error = Happiness.Game.ErrorDetector && !GameScene.Puzzle.IsCorrect(y, x);
                        sb.Draw(GameScene.GetIcon(y, iFinal), r, error ? Color.Red : Color.White);

                        if (GameScene.ShouldDrawHint(y, x, iFinal))
                        {
                            Assets.HintSprite.Draw(sb, r, Color.White);
                        }
                    }
                    else
                    {
                        for (int iIcon = 0; iIcon < GameScene.Puzzle.m_iSize; iIcon++)
                        {
                            if (GameScene.Puzzle.m_Rows[y].m_Cells[x].m_bValues[iIcon])
                            {
                                Rectangle r = m_SmallRects[iIcon];
                                r.Offset(xcoord, ycoord);
                                sb.Draw(GameScene.GetIcon(y, iIcon), r, Color.White);

                                if (GameScene.ShouldDrawHint(y, x, iIcon))
                                {
                                    Assets.HintSprite.Draw(sb, r, Color.White);
                                }
                            }
                            else if (Happiness.Game.ErrorDetector2 && GameScene.Puzzle.SolutionIcon(y, x) == iIcon)
                            {
                                Rectangle r = m_SmallRects[iIcon];
                                r.Offset(xcoord, ycoord);
                                sb.Draw(GameScene.GetIcon(y, iIcon), r, new Color(Color.Red, 0.0625f));
                            }
                        }
                    }
                }
            }
        }