带有Class的XNA Spritebatch.End()在启动时不起作用

时间:2014-06-03 16:25:49

标签: c# xna

XNA spritebatch.End();有一个类没有用,它说:' XNA Framework Reach配置文件要求TextureAddressMode在使用不是2的幂的纹理大小时是Clamp。'什么时候开始并且它也没有显示任何错误。我怎么解决这个问题?请帮忙!!

 public override void Draw()
    {
        Statics.SPRITEBATCH.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, null,null);

        Statics.SPRITEBATCH.Draw(this.background, Vector2.Zero, Color.White);

        foreach (var item in Tuyaux)
        {
            item.Draw();
        }

        Statics.SPRITEBATCH.Draw(this.sand, new Vector2(0, 529), Color.White);

        Scroll.Draw();

        Bird.Draw();

        Statics.SPRITEBATCH.DrawString(this.Font, "Score : " + this.score.ToString(), new Vector2(10, 10), Color.Red);

        if (Bird.dead)
        {
            // rode gloed over het spel als het gameover is.
            Statics.SPRITEBATCH.Draw(Statics.PIXEL, new Rectangle(0,0, Statics.GAME_WIDTH,Statics.GAME_HEIGHT), new Color(1f, 0f, 0f, 0.3f));
            // gameover achtergrond laten zien.
            Statics.SPRITEBATCH.Draw(this.gameover, new Vector2(0, 80), Color.White);
        }

        Statics.SPRITEBATCH.End(); 
        base.Draw();
    }

1 个答案:

答案 0 :(得分:0)

问题正是异常告诉你的:

您正在定位Reach配置文件,因此要么所有纹理尺寸必须是2的幂,要么必须使用clamp作为地址模式。所以:

  • 如果您不需要换行,请尝试在SamplerState.LinearWrap来电中将SamplerState.LinearClamp替换为Statics.SPRITEBATCH.Begin
  • 如果您需要包装纹理,请确保所有这些纹理都具有2的幂
  • 最后但并非最不重要的是,如果它是您的选项,您只需使用HiDef个人资料而不是Reach
相关问题