Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            startGameSplash = Content.Load <Texture2D>("start-splash");
            stateFont       = Content.Load <SpriteFont>("GameState");
            fontScoreP1     = Content.Load <SpriteFont>("ScoreP1");
            fontScoreP2     = Content.Load <SpriteFont>("ScoreP2");
            music           = Content.Load <Song>("entrtanr");

            //  Uncomment the following line will also loop the song
            //  MediaPlayer.IsRepeating = true;
            MediaPlayer.MediaStateChanged += MediaPlayer_MediaStateChanged;
            MediaPlayer.Play(music);

            //// Create all cards
            for (int i = 1; i < 14; i++)
            {
                m_allCards.Add(new Card(Card.SuitEnum.EClubs, i, NextZ(), this.Content));
            }

            for (int i = 1; i < 14; i++)
            {
                m_allCards.Add(new Card(Card.SuitEnum.EDiamond, i, NextZ(), this.Content));
            }

            for (int i = 1; i < 14; i++)
            {
                m_allCards.Add(new Card(Card.SuitEnum.ESpade, i, NextZ(), this.Content));
            }

            for (int i = 1; i < 14; i++)
            {
                m_allCards.Add(new Card(Card.SuitEnum.EHeart, i, NextZ(), this.Content));
            }

            m_deck.LoadBackground(this.Content);
            m_deck.Position = new Point((int)(4 * screenWidth / 5), (int)screenHeight / 2 - Card.CARD_HEIGHT / 2);

            m_allCards_cpy = m_allCards.ToList();
        }