Ejemplo n.º 1
0
 private static void DrawGame(BlackJackGame game)
 {
     Graphics.ClearScreen();
     Images.DrawBitmap (BackgroundImage, 0, 0);
     if (_showhelp)
         Images.DrawBitmap (Simpleguide, 0, 240);
     game.DrawGame ();
     SwinGame.RefreshScreen(60);
 }
Ejemplo n.º 2
0
 private static void DrawGame(BlackJackGame game)
 {
     Graphics.ClearScreen();
     Images.DrawBitmap(BackgroundImage, 0, 0);
     if (_showhelp)
     {
         Images.DrawBitmap(Simpleguide, 0, 240);
     }
     game.DrawGame();
     SwinGame.RefreshScreen(60);
 }
Ejemplo n.º 3
0
        public static void Main()
        {
            SwinGame.OpenGraphicsWindow("BlackJack", 800, 600);
            LoadResources ();
            Audio.PlayMusic (music);

            Dealer dealer = new Dealer();
            Deck deck = new Deck();
            Player player = new Player();
            BlackJackGame game = new BlackJackGame(deck, player, dealer);
            game.DealFirstTwoCards();

            while (false == SwinGame.WindowCloseRequested())
            {
                PlayerleUserInput (game);
                DrawGame (game);
                SwinGame.RefreshScreen(60);
            }
        }
Ejemplo n.º 4
0
        public static void Main()
        {
            SwinGame.OpenGraphicsWindow("BlackJack", 800, 600);
            LoadResources();
            Audio.PlayMusic(music);

            Dealer        dealer = new Dealer();
            Deck          deck   = new Deck();
            Player        player = new Player();
            BlackJackGame game   = new BlackJackGame(deck, player, dealer);

            game.DealFirstTwoCards();

            while (false == SwinGame.WindowCloseRequested())
            {
                PlayerleUserInput(game);
                DrawGame(game);
                SwinGame.RefreshScreen(60);
            }
        }
Ejemplo n.º 5
0
        private static void PlayerleUserInput(BlackJackGame game)
        {
            //Fetch the next batch of UI interaction
            SwinGame.ProcessEvents();

            if (!game.Decision)
            {
                if (SwinGame.KeyTyped(KeyCode.vk_d))
                {
                    if (game.Double == false)
                    {
                        game.DoubleDown();
                    }
                }

                if (SwinGame.KeyTyped(KeyCode.vk_p))
                {
                    game.PlayingGame();
                }

                if (SwinGame.KeyTyped(KeyCode.vk_SPACE))
                {
                    if (game.Double == false && game.Status == GameState.PLAYING)
                    {
                        Audio.PlaySoundEffect(CardSlide);
                        game.Player.AddCard((game.Deck.Draw()));
                        game.CheckScores();
                    }
                }

                if (SwinGame.KeyTyped(KeyCode.vk_s))
                {
                    if (game.Status == GameState.PLAYING)
                    {
                        game.Dealer.Deal(game.Deck);
                        game.Decision = true;
                        game.CheckScores();
                    }
                }
            }

            if (SwinGame.KeyTyped(KeyCode.vk_r))
            {
                game.RestartGame();
            }

            if (SwinGame.KeyTyped(KeyCode.vk_c))
            {
                if (GameState.BETTING == game.Status)
                {
                    game.Player.BetDown();
                }
            }

            if (SwinGame.KeyTyped(KeyCode.vk_b))
            {
                if (GameState.PLAYING != game.Status)
                {
                    if (game.Player.Money <= 0)
                    {
                        Console.WriteLine("You dont have any money Left");
                    }
                    else
                    {
                        game.Player.BetUp();
                    }
                }
            }
            if (SwinGame.KeyTyped(KeyCode.vk_h))
            {
                _showhelp = !_showhelp;
            }
        }
Ejemplo n.º 6
0
        private static void PlayerleUserInput(BlackJackGame game)
        {
            //Fetch the next batch of UI interaction
            SwinGame.ProcessEvents();

            if (!game.Decision)
            {
                if (SwinGame.KeyTyped(KeyCode.vk_d))
                {
                    if (game.Double == false) {
                        game.DoubleDown ();

                    }
                }

                if (SwinGame.KeyTyped(KeyCode.vk_p))
                {
                    game.PlayingGame ();
                }

                if (SwinGame.KeyTyped(KeyCode.vk_SPACE))
                {
                    if (game.Double == false && game.Status == GameState.PLAYING) {
                        Audio.PlaySoundEffect (CardSlide);
                        game.Player.AddCard ((game.Deck.Draw ()));
                        game.CheckScores ();
                    }
                }

                if (SwinGame.KeyTyped(KeyCode.vk_s))
                {
                    if (game.Status == GameState.PLAYING)
                    {
                        game.Dealer.Deal (game.Deck);
                        game.Decision = true;
                        game.CheckScores ();
                    }
                }
            }

            if (SwinGame.KeyTyped (KeyCode.vk_r))
            {
                game.RestartGame ();
            }

            if (SwinGame.KeyTyped (KeyCode.vk_c))
            {
                if (GameState.BETTING == game.Status) {
                    game.Player.BetDown ();
                }
            }

            if (SwinGame.KeyTyped (KeyCode.vk_b))
            {
                if (GameState.PLAYING != game.Status) {
                    if (game.Player.Money <= 0) {
                        Console.WriteLine ("You dont have any money Left");
                    } else {
                        game.Player.BetUp ();
                    }
                }
            }
            if (SwinGame.KeyTyped (KeyCode.vk_h))
            {
                _showhelp = !_showhelp;

            }
        }