示例#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()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     Services.AddService(spriteBatch);
     spriteRender = new SpriteRender(this.spriteBatch);
     Services.AddService(spriteRender);
     Textures.Load(Content);
     screenManager = new ScreenManager(this);
     Services.AddService(screenManager);
     screenManager.AddScreen(new BackgroundScreen(this));
     screenManager.AddScreen(new MainScreen(this));
 }
示例#2
0
 public void Draw(GameTime gameTime, SpriteRender spriteRender, Vector2 position, float scale)
 {
     if (!ended) {
         spriteRender.Draw(
             spriteSheet.Sprite(frames[curFrame]),
             position,
             Color.White,
             0,
             scale,
             SpriteEffects.None
         );
     }
 }
        /// <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.
            this.spriteBatch = new SpriteBatch(GraphicsDevice);
            this.spriteRender = new SpriteRender(this.spriteBatch);

            var spriteSheetLoader = new SpriteSheetLoader(this.Content);
            this.spriteSheet = spriteSheetLoader.Load("CapGuyDemo.png");
            this.backgroundSprite = this.spriteSheet.Sprite(TexturePackerMonoGameDefinitions.CapGuyDemo.Background);
            this.centreScreen = new Vector2 (this.GraphicsDevice.Viewport.Width / 2, this.GraphicsDevice.Viewport.Height / 2);

            this.InitialiseAnimationManager();
        }