GameEngine2D

Reply

Level 1

Level 1
Smoggie83
Posts: 20
Registered: ‎25-06-2012
Message 1 of 6 (256 Views)

Spritesheets with varying image sizes

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

Please use plain text.

Level 1

Level 1
Smoggie83
Posts: 20
Registered: ‎25-06-2012
Message 2 of 6 (252 Views)

Re: Spritesheets with varying image sizes

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.

Please use plain text.

Member

Member
Killa_Kastro
Posts: 1
Registered: ‎30-06-2012
Message 3 of 6 (230 Views)

Re: Spritesheets with varying image sizes

I would like to see a tut on that. And another question are you loading xml on the vita or an android device?

Please use plain text.

Level 1

Level 1
Smoggie83
Posts: 20
Registered: ‎25-06-2012
Message 4 of 6 (225 Views)

Re: Spritesheets with varying image sizes

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?

Please use plain text.

Re: Spritesheets with varying image sizes

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

PlayStation®Mobile Dev Team
Please use plain text.

Level 1

Level 1
Smoggie83
Posts: 20
Registered: ‎25-06-2012
Message 6 of 6 (197 Views)

Re: Spritesheets with varying image sizes

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

Please use plain text.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

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を一度ログアウトし、再度ログインしてください。