示例#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);
            if (useCustomTexture)
            {
                customTexture = Texture2D.FromStream(GraphicsDevice, custStream);
            }
            song = Content.Load <Song>("Call to Adventure");
            Sprite s = new Sprite(Content.Load <Texture2D>("PongCircle"), new Vector2(370, 180), spriteBatch);

            s.UpdateParams = new UpdateParamaters(true, true, true);
            Sprite p1 = new Sprite(useCustomTexture ? customTexture : Content.Load <Texture2D>("PongSprite1"), new Vector2(0, 160), spriteBatch);

            p1.Scale = useCustomTexture ? new Vector2(80f / customTexture.Width, 80f / customTexture.Height) : new Vector2(1);
            Sprite p2 = new Sprite(Content.Load <Texture2D>("PongSprite2"), new Vector2(720, 160), spriteBatch);

            s.Updated  += new EventHandler(s_Updated);
            p1.Updated += new EventHandler(p1_Updated);
            p2.Updated += new EventHandler(p2_Updated);

            if (MediaPlayer.State != MediaState.Playing)
            {
                MediaPlayer.Play(song);
            }

            //sm = new SpriteManager(spriteBatch, logo, play, playhighlite, singleplayer, singleplayerhighlite);

            menu.Load(spriteBatch, Content);
            gameengine.Load(spriteBatch, Content, graphics.GraphicsDevice.Viewport, useCustomTexture, customTexture);
            // TODO: use this.Content to load your game content here
        }