on 25-06-2012 10:04 PM
Hi,
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?
Cheers
Dave
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 04:43 PM
I would like to see a tut on that. And another question are you loading xml on the vita or an android device?
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
Hi Smoggie83,
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.
Best regards,
James
on 09-07-2012 10:22 AM
Hi James,
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.
Cheers
Dave
PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.
フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと
PSM DevPortalを一度ログアウトし、再度ログインしてください。


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]
%%http://community.eu.playstation.com/t5/Announcements/Beta-Trial-Information/td-p/11386362
best_shooter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_driver.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_performer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_footballer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_fighter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_creator.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_action_player.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
dev2.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Producer-and-Developer-Ranks/td-p/18407352
trophy.gif%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/The-Community-Awards-FAQ/td-p/18407096
PSlogoSM.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Online-Support-Coordinator-rank/td-p/18414870