Beispiel #1
0
        /* Various Drawing Functions */
        internal void DrawScreen(SurfaceControl surfaceControl, PlayState playState, Hand userHand, AI[] computerPlayers,
                                 int[] clicked, bool passing, bool playing, bool showAll)
        {
            surf.Fill(Color.Green);

            name1 = buttonFont.Render(playState.UserName, Color.White);
            name2 = buttonFont.Render(computerPlayers[0].Name, Color.White);
            name3 = buttonFont.Render(computerPlayers[1].Name, Color.White);
            name4 = buttonFont.Render(computerPlayers[2].Name, Color.White);

            if (playing || passing || showAll)
            {
                surf.Blit(name1, new Point(247 - name1.Width, 582 - name1.Height));
                surf.Blit(name2, new Point(15, 114 - name2.Height));
                surf.Blit(name3, new Point(532, 18));
                surf.Blit(name4, new Point(782 - name4.Width, 476));
            }
            int temp = 0;

            for (int i = 0; i < 3; i++)
            {
                if (clicked[i] >= 0)
                {
                    temp++;
                }
            }
            passCount = temp;
            if (passCount == 3 && passing && !playing)
            {
                if (playState.PassingMode == 0)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Left", Color.Black);
                    surf.Blit(passButtonFont, new Point(411, 408));
                }
                if (playState.PassingMode == 1)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Across", Color.Black);
                    surf.Blit(passButtonFont, new Point(403, 408));
                }
                if (playState.PassingMode == 2)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Right", Color.Black);
                    surf.Blit(passButtonFont, new Point(409, 408));
                }
            }
            else if (passing && !playing)
            {
                if (playState.PassingMode == 0)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Left", Color.Gray);
                    surf.Blit(passButtonFont, new Point(411, 408));
                }
                if (playState.PassingMode == 1)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Across", Color.Gray);
                    surf.Blit(passButtonFont, new Point(403, 408));
                }
                if (playState.PassingMode == 2)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Right", Color.Gray);
                    surf.Blit(passButtonFont, new Point(409, 408));
                }
            }

            int x = 250, y = 462;

            for (int j = 0; j < userHand.Cards.Count; j++)
            {
                if ((clicked[0] == j || clicked[1] == j || clicked[2] == j) && passing)
                {
                    DrawCardFaceUp(userHand.Cards[j], x, y, true);
                }
                else
                {
                    if (playState.Clicked == j)
                    {
                        DrawInverted(userHand.Cards[j], x, y);
                    }
                    else
                    {
                        DrawCardFaceUp(userHand.Cards[j], x, y, false);
                    }
                }
                x += 20;
            }

            if (!showAll)
            {
                x = 15; y = 120;
                for (int j = computerPlayers[0].AIHand.Cards.Count - 1; j >= 0; j--)
                {
                    DrawCardFaceDown(x, y, 1, passing, playState.CardsPassingContains(0, j));
                    y += 20;
                }

                x = 450; y = 15;
                for (int j = computerPlayers[1].AIHand.Cards.Count - 1; j >= 0; j--)
                {
                    DrawCardFaceDown(x, y, 2, passing, playState.CardsPassingContains(1, j));
                    x -= 20;
                }
                x = 706; y = 350;
                for (int j = computerPlayers[2].AIHand.Cards.Count - 1; j >= 0; j--)
                {
                    DrawCardFaceDown(x, y, 3, passing, playState.CardsPassingContains(2, j));
                    y -= 20;
                }
            }
            else
            {
                x = 15; y = 120;
                for (int j = 0; j < computerPlayers[0].AIHand.Cards.Count; j++)
                {
                    DrawCardFaceUp(computerPlayers[0].AIHand.Cards[j], x, y, false);
                    y += 20;
                }
                x = 450; y = 15;
                for (int j = 0; j < computerPlayers[1].AIHand.Cards.Count; j++)
                {
                    DrawCardFaceUp(computerPlayers[1].AIHand.Cards[j], x, y, false);
                    x -= 20;
                }
                x = 706; y = 350;
                for (int j = 0; j < computerPlayers[2].AIHand.Cards.Count; j++)
                {
                    DrawCardFaceUp(computerPlayers[2].AIHand.Cards[j], x, y, false);
                    y -= 20;
                }
            }

            if (playState.Trick.Count != 0)
            {
                DrawTricks(playState);
            }

            surfaceControl.Blit(surf);
        }
Beispiel #2
0
 /* Constructor */
 internal GraphicsEngine(SurfaceControl surfaceControl)
 {
     surf = Video.CreateRgbSurface(surfaceControl.Width, surfaceControl.Height, 32, 0, 0, 0, 0, true);
     LoadImages();
 }