on 13-07-2012 05:06 PM
I have 3 types of sprites in my project:
- 48x48 tiles
- 100x100 tiles
- loose sprites with various sizes
I want to put them all in a one big texture so all the sprites can get batched nicely, the problem is that since SpriteList needs a TextureInfo and not the Texture2D it seems to me that I can't set up the texture tiling (because it's set per TextureInfo).
There is no problem at all if I would use SpriteUV for all the sprites, but is there any way to get the SpriteList to work with two TextureInfos using the same Texture2D ?
If not, would I be better off with one SpriteList with:
-1 TextureInfo and lots of SpriteUVs
-2 SpriteLists with 2 different TextureInfos using the same Texture2D and SpriteTiles + SpriteUVs?
on 13-07-2012 10:38 PM
You are correct in that a SpriteList requires a TextureInfo object, however in the constructor for the TextureInfo, you will need to pass in your Texture2D object. Also in the constructor for the TextureInfo, you will need to specify the number of tiles that you would like your Sprite Sheet / Tile Map divided up into.
TextureInfo info = new TextureInfo(new Texture2D("/Application/sprites.png", false), new Vector2i(5,5)); SpriteList list = new SpriteList(info);
From here, you can then create some SpriteTile objects, selecting the TileIndex2D/1D and add these to your SpriteList.
If you have any questions, please feel free to ask.
Website ©2013 Sony Computer Entertainment Europe
All content, game titles, trade names and/or trade dress, trademarks, artwork and associated imagery are trademarks and/or copyright material of their respective owners. All rights reserved. [more info]