コード例 #1
0
ファイル: Game1.cs プロジェクト: bruinbrown/DevSCMonogame
        /// <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 );

            var startAsteroid = new Asteroid( this.graphics.PreferredBackBufferWidth, this.graphics.PreferredBackBufferHeight, this.Content );
            startAsteroid.Destroyed += new EventHandler( ( sender, e ) =>
            {
                score += ( sender as Asteroid ).Score;
            } );
            asteroids.Add( startAsteroid );

            dino = new Dinosaur( graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, Content );
            dino.Killed += new EventHandler( HandleGameOver );

            scoreFont = Content.Load<SpriteFont>( "Fonts/scorefont" );

            // TODO: use this.Content to load your game content here
            font = Content.Load<SpriteFont>( "spriteFont1" );
        }