コード例 #1
0
ファイル: Table.cs プロジェクト: MattGraffunder/Blackjack
        public void Initialize(Input input, int height, int width, CardDisplay cardDisplay, TextDisplay textDisplay, ChipDisplay chipDisplay)
        {
            _input = input;

            _height = height;
            _width  = width;

            _cardDisplay = cardDisplay;
            _textDisplay = textDisplay;
            _chipDisplay = chipDisplay;

            _playerChips = 1000; // Start at 1000
            _playerBet   = 10;   // Default to 10

            _deck.ShuffleDeck();
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: MattGraffunder/Blackjack
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();

            input = InputFactory.GetInput();

            TextDisplay textDisplay = new TextDisplay();

            textDisplay.Initialize(Content.Load <SpriteFont>("BlackJackFont"));

            CardDisplay cardDisplay = new CardDisplay();

            cardDisplay.Initialize(Content.Load <Texture2D>("Card-Faces"), Content.Load <Texture2D>("Card-Back"));

            ChipDisplay chipDisplay = new ChipDisplay();

            chipDisplay.Initialize(Content.Load <Texture2D>("Chips"), textDisplay);

            _table = new Table();
            _table.Initialize(input, GraphicsDevice.Viewport.Height, GraphicsDevice.Viewport.Width, cardDisplay, textDisplay, chipDisplay);
        }