예제 #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // firstly, show the Players form
            PlayersForm form = new PlayersForm();

            // if we added at least one player and pressed OK, then start:
            if (form.ShowDialog() == DialogResult.OK)
            {
                statistics = form.GameStats;

                // create new game object
                game = new BlackjackGame();

                // initialize visualizer
                gamevisualizer = new CardTableVisualizer(game);
                gamevisualizer.PrepareGraphics(this.Width, this.Height, CreateGraphics());

                // initialize controller:
                // pass the game and visualizer objects
                // and the FixGameResults() function as the function that will be called when the game's over
                gamecontroller = new CardTableController(game, gamevisualizer, FixGameResults);

                // set the list of active players for a new game
                game.SetPlayerList(form.GetActivePlayers());

                // start new game
                NewGame();
            }
            else
            {
                Close();
            }
        }
예제 #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // firstly, show the Players form
            PlayersForm form = new PlayersForm();

            // if we added at least one player and pressed OK, then start:
            if (form.ShowDialog() == DialogResult.OK)
            {
                statistics = form.GameStats;

                // create new game object
                game = new BlackjackGame();

                // initialize visualizer
                gamevisualizer = new CardTableVisualizer(game);
                gamevisualizer.PrepareGraphics(this.Width, this.Height, CreateGraphics());

                // initialize controller:
                // pass the game and visualizer objects
                // and the FixGameResults() function as the function that will be called when the game's over
                gamecontroller = new CardTableController(game, gamevisualizer, FixGameResults);

                // set the list of active players for a new game
                game.SetPlayerList( form.GetActivePlayers() );

                // start new game
                NewGame();
            }
            else
            {
                Close();
            }
        }
예제 #3
0
        private void MainForm_Resize(object sender, EventArgs e)
        {
            // if the form was resized...
            Graphics DC = CreateGraphics();

            // create new double buffered bitmap
            gamevisualizer.PrepareGraphics(this.Width, this.Height, DC);
            // and plot it
            DC.DrawImage(gamevisualizer.GetShowTable(), 0, 0);
        }