on 25-06-2012 10:04 PM
I am relatively new to the SDK and I am trying to work out a way to load in spritesheets similar to how I do in Cocos2d. I have an image and whereas on iOS I would have a plist I have an XML file instead which I add to a texture cache.
All the information is parsed from the XML file suchas frame name, x & y position in the spritesheet and the size of the sprite frame but then how do I use this data to create a sprite from that part of the texture2D? I was trying to use SpriteTile but this seems to only support spritesheets where every image is the same size, is this correct?
on 25-06-2012 10:50 PM
Ah ok, I solved it.
I load the spritesheets png file into an Image and decode it and then use the imaging function crop on it with values loaded from my texturepacker XML file. I then create a texture from the cropped image and apply this to a Sprite UV.
If anyone wants me to write this up in a tutorial let me know.
on 30-06-2012 06:50 PM
I've actually found that loading all the sprites from a spritesheet seems to be a lot slower with PSM than when I have used them in Cocos2D. It actually seems to run a lot faster to have the graphics seperately rather than in one big sheet.
Has anyone found this?
on 09-07-2012 10:07 AM
Its difficult to comment fully without seeing the source code and some information on how many sprites we are talking about here, however if your dealing with a large number of sprites it's possible that you may see performance increases if you used a combination of SpriteLists and SpriteTiles. These will help you to reduce the number of textures that you have in memory, in addition to reducing the number of draw calls that the GameEngine2D library is having to make.
If you'd like any help setting up some SpriteLists/Tiles, please let us know.
on 09-07-2012 10:22 AM
I actually think it came down to how I was loading the images from the Texture2D when it was built from various different sizes of sprite. The only way I could see of doing it was after storing the coordinates of each sprite in the spritesheet was to make an image from the texture and then use an image crop to cut out the relevant sprite and return it but this seemed quite slow/expensive.
I have got spritesheets working if all the items are the same size as like you say then it becomes alot easier to use spritelists and tiles then.
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]