To elaborate :
I have a tileset with 4 tiles [32 x 32]. For sake of the example let s call them Dirt, Grass, Asphalt, Cement.
I want to draw a relatively long surface of Grass [96 x 32]. Is there any way to use the tiling mechanism of XNA (LinearWarp) to draw them using single Draw() call ?
我尝试:
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap,null,null);
GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
spriteBatch.Draw(_tileSetTexture /* 64 x 64 */, destRectangle/* 96 x 32*/, TileFrame /*32 x 32*/, Color.White, 0f , Vector2.Zero ,SpriteEffects.None, 0f);
我知道,可以选择将每一块土地推向不同的文本2D,然后使用XNA LinearWrap的“延伸”源径,以填补这一空白,但我需要它们都掌握一个大的TileSet图像,并尽可能简单地加以实现。