Exemple #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);

            // Create a rendertarget that matches the back buffer's dimensions, does not generate mipmaps automatically
            // (the Reach profile requires power of 2 sizing in order to do that), uses an RGBA color format, and
            // has no depth buffer or stencil buffer.

            renderTarget 	= new RenderTarget2D (GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth,GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None);

            TileSheet 			= Content.Load<Texture2D>("tilesheet.png");
            font 				= Content.Load<SpriteFont>("spriteFont1");
            animatedTilesheet 	= Content.Load<Texture2D>("AnimationTiles.png");

            fps 				= new FPSCounterComponent(this,spriteBatch,font);
            level 				= MapLoader.ReadFile("./Content/map.txt", TileSheet,animatedTilesheet, this);
            glasses 			= new GlassesUI(this, spriteBatch);
            player				= new Player(this);
            Vector2 playerPos 	= new Vector2(
                (this.Window.ClientBounds.Width / 2 ) - 16,
                (this.Window.ClientBounds.Height / 2) - 32
                );

            this.controls = new Controls(this,glasses);

            player.Initalise(this,animatedTilesheet,spriteBatch,playerPos);
            bkgnd.Initialise(Content.Load<Texture2D>("Background2"),800);

            Components.Add(fps);
        }