Пример #1
0
        /* Various Drawing Functions */
        internal void DrawScreen(SurfaceControl surfaceControl, Tableau tableau)
        {
            surf.Fill(Color.Green);

            DrawCards(tableau);

            if (GameOver == -1)
            {
                Font       = font.Render("You Lose !", Color.Red);
                FontShadow = font.Render("You Lose !", Color.DarkRed);
                surf.Blit(FontShadow, new Point((surf.Width - Font.Width) / 2 + 2, (surf.Height - Font.Height) / 2 + 2));
                surf.Blit(Font, new Point((surf.Width - Font.Width) / 2, (surf.Height - Font.Height) / 2));
            }
            else if (GameOver == 1)
            {
                Font       = font.Render("You Win !", Color.Red);
                FontShadow = font.Render("You Win !", Color.DarkRed);
                surf.Blit(FontShadow, new Point((surf.Width - Font.Width) / 2 + 2, (surf.Height - Font.Height) / 2 + 2));
                surf.Blit(Font, new Point((surf.Width - Font.Width) / 2, (surf.Height - Font.Height) / 2));
            }
            if (tableau.FireworksLeft >= 0)
            {
                particles.Update();
                particles.Render(surf);
            }
            surfaceControl.Blit(surf);
        }
Пример #2
0
        private void DrawPiles(Tableau tableau)
        {
            for (int i = 0; i < 8; i++)
            {
                int spacing = CardSpacing;
                if (tableau.Piles[i].Count > 10)
                {
                    spacing -= (int)((tableau.Piles[i].Count - 10) * 1.5);
                }
                for (int j = 0; j < tableau.Piles[i].Count; j++)
                {
                    if (tableau.Clicked[0] == i && tableau.Clicked[1] <= j)
                    {
                        surf.Blit(drawer.DrawCardInverted(tableau.Piles[i][j]),
                                  new Point(LeftOfPiles + (i * (CardWidth + PileSpacing)), TopOfPiles + (j * spacing)));
                    }
                    else
                    {
                        surf.Blit(drawer.DrawCardFaceUp(tableau.Piles[i][j]),
                                  new Point(LeftOfPiles + (i * (CardWidth + PileSpacing)), TopOfPiles + (j * spacing)));
                    }
                }

                if (tableau.TopCard[0] == i)
                {
                    surf.Blit(drawer.DrawCardFaceUp(tableau.Piles[tableau.TopCard[0]][tableau.TopCard[1]]),
                              new Point(LeftOfPiles + (tableau.TopCard[0] * (CardWidth + PileSpacing)), TopOfPiles + (tableau.TopCard[1] * spacing)));
                }
            }
        }
Пример #3
0
        private void DrawCards(Tableau tableau)
        {
            DrawBackground();

            DrawCells(tableau);

            DrawFoundation(tableau);

            DrawPiles(tableau);
        }
Пример #4
0
 private void DrawFoundation(Tableau tableau)
 {
     for (int i = 0; i < 4; i++)
     {
         if (tableau.Foundation[i] != null)
         {
             surf.Blit(drawer.DrawCardFaceUp(tableau.Foundation[i]),
                       new Point(LeftOfFoundation + (i * (CardWidth + 4)) + 2, TopOfCells + 2));
         }
     }
 }
Пример #5
0
        internal void ExplodeFirework(Tableau tableau)
        {
            ParticleCircleEmitter explosion = new ParticleCircleEmitter(particles, tableau.FireworkColorMin[tableau.FireworksLeft], tableau.FireworkColorMax[tableau.FireworksLeft], 1, 3);

            explosion.X           = tableau.FireworkPosX[tableau.FireworksLeft]; // location
            explosion.Y           = tableau.FireworkPosY[tableau.FireworksLeft];
            explosion.Life        = 20;                                          // life of the explosion
            explosion.Frequency   = 100000;
            explosion.LifeMin     = 10;
            explosion.LifeMax     = 60;
            explosion.LifeFullMin = 10;
            explosion.LifeFullMax = 60;
            explosion.SpeedMin    = 2;
            explosion.SpeedMax    = 10;
        }
Пример #6
0
 private void DrawCells(Tableau tableau)
 {
     for (int i = 0; i < 4; i++)
     {
         if (tableau.Cells[i] != null)
         {
             if (tableau.Clicked[0] == 8 && tableau.Clicked[1] == i)
             {
                 surf.Blit(drawer.DrawCardInverted(tableau.Cells[i]),
                           new Point(LeftOfCells + (i * (CardWidth + 4)) + 2, TopOfCells + 2));
             }
             else
             {
                 surf.Blit(drawer.DrawCardFaceUp(tableau.Cells[i]),
                           new Point(LeftOfCells + (i * (CardWidth + 4)) + 2, TopOfCells + 2));
             }
         }
     }
 }
Пример #7
0
        /* Constructor */
        internal Engine()
        {
            InitializeComponent();

            Bitmap bitmap = new Bitmap(Properties.Resources.DownArrow);

            myCursor = CreateCursor(bitmap, 9, 30);
            bitmap.Dispose();

            gEngine = new GraphicsEngine(surfaceControl1);
            tableau = new Tableau();
            deck    = new Deck(false);
            options = new Options();

            SdlDotNet.Core.Events.TargetFps        = 500;
            SdlDotNet.Core.Events.Quit            += new EventHandler <QuitEventArgs>(ApplicationQuit);
            SdlDotNet.Core.Events.MouseButtonDown += new EventHandler <MouseButtonEventArgs>(MouseButtonDownEvent);
            SdlDotNet.Core.Events.MouseMotion     += new EventHandler <MouseMotionEventArgs>(MouseMotionEvent);
            SdlDotNet.Core.Events.MouseButtonUp   += new EventHandler <MouseButtonEventArgs>(MouseButtonUpEvent);
            SdlDotNet.Core.Events.Tick            += new EventHandler <TickEventArgs>(Events_Tick);
        }
Пример #8
0
 /* Form Event Methods */
 private void dealToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (isGameRunning)
     {
         var result = MessageBox.Show("Dealing will forfiet the current game.\nAre you sure?",
                                      "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                      MessageBoxDefaultButton.Button1);
         if (result == DialogResult.Yes || result == DialogResult.OK)
         {
             tableau = new Tableau();
             Deal();
             options.GamesForfiet++;
             options.SaveOptions();
         }
     }
     else
     {
         tableau = new Tableau();
         Deal();
     }
 }