Sourcerect question
by Hilbert Reijngoudt · in iTorque 2D · 03/24/2012 (3:03 pm) · 6 replies
I have a memory issue in my game, it's so bad that the game crashes constantly on the ipad 1. Almost none of my images are square or have a size of power of 2. So i started to clean up the whole mess of images and started putting them in spritesheets using unchaos. I found out that i can use the variables created in the txt file to set the sourcerect for static sprites.
No problems so far.
But the thing is, a lot of my static sprites are created in the editor and i can't use the variable names this way. Does this mean i can only use the sourcerect in the editor by putting in the coordinates by hand in the editor? This doesn't seem like a nice solution, if some art would change afterwards and i have to build my spritesheets again then i have to check if all my cooridinates are still ok.
So my question is, can i use the variables from the txt file created by unchaos for my static sprites created in the editor?
No problems so far.
But the thing is, a lot of my static sprites are created in the editor and i can't use the variable names this way. Does this mean i can only use the sourcerect in the editor by putting in the coordinates by hand in the editor? This doesn't seem like a nice solution, if some art would change afterwards and i have to build my spritesheets again then i have to check if all my cooridinates are still ok.
So my question is, can i use the variables from the txt file created by unchaos for my static sprites created in the editor?
#2
I saw a similar tool called Zwoptex, but that one's only available for the mac. And since i do most of my work on windows i'm glad you told me about this tool!
Maybe a dumb question, how do i ping you on this site?
Did you also find a solution for the sprites that are created in the editor?
Thanks for the help!
03/25/2012 (6:26 am)
@Scott, thanks for the reply!I saw a similar tool called Zwoptex, but that one's only available for the mac. And since i do most of my work on windows i'm glad you told me about this tool!
Maybe a dumb question, how do i ping you on this site?
Did you also find a solution for the sprites that are created in the editor?
Thanks for the help!
#3
scott.wilsonbilling@xtremics.biz
I don't use the editor at all; our data blocks are created programatically - I find it quicker.
However, I can see one slight issue with texture packer - the custom exporter is only currently available in the Mac version. You need the exporter, otherwise you will be manually copying and pasting the sourcerect values, something you don't want to do.
03/25/2012 (12:30 pm)
@Hilbert, sorry, by ping, I meant send me an email.scott.wilsonbilling@xtremics.biz
I don't use the editor at all; our data blocks are created programatically - I find it quicker.
However, I can see one slight issue with texture packer - the custom exporter is only currently available in the Mac version. You need the exporter, otherwise you will be manually copying and pasting the sourcerect values, something you don't want to do.
#4
I still got a problem though. Everything is working fine for static sprites that are created in script. But the problem i still have is with the static sprites that are created in the editor. I now have a script file which contains all my sourcerect variables. I tried the following for editor created static sprites :
I created the following datablock :
And tried to use it in the editor for a static sprite, but it doesn't work, not even when i put the sourcerect and size directly in the datablock.
I'm getting kinda desperate since i created my levels in the editor.
Any of the devs know a solution for this?
04/04/2012 (12:10 pm)
@Scott, thanks for the help!I still got a problem though. Everything is working fine for static sprites that are created in script. But the problem i still have is with the static sprites that are created in the editor. I now have a script file which contains all my sourcerect variables. I tried the following for editor created static sprites :
I created the following datablock :
datablock t2dSceneObjectDatablock( testDatablock )
{
mUseSourceRect = "1";
imageMap = "static_sprites_ImageMap";
size = $test_sprite_SIZE;
sourceRect = $test_sprite_SOURCE_RECT;
};And tried to use it in the editor for a static sprite, but it doesn't work, not even when i put the sourcerect and size directly in the datablock.
I'm getting kinda desperate since i created my levels in the editor.
Any of the devs know a solution for this?
#5
04/04/2012 (2:55 pm)
@Hilbert, I'm pretty sure you can't use a source rect in a data block - it needs to be in your game when you create the t2dstaticsprite. I don't use the editor at all, preferring to hand craft the level data blocks.
#6
I can't imagine no one ever had this problem, this way the editor is useless if you want to use sourcerects, or you have to put in the coordinates by hand in the editor, but then if there would be a change in your png you could have to enter them all again...
04/05/2012 (2:33 am)
@Scott, I think there's no other way than to stop using the editor. I on the other hand love making my levels with the editor because it's much more tedious to do this in code.I can't imagine no one ever had this problem, this way the editor is useless if you want to use sourcerects, or you have to put in the coordinates by hand in the editor, but then if there would be a change in your png you could have to enter them all again...
Torque Owner Scott Wilson-Billing
MeYuMe
Re-packed all my sprites using Texturepacker and a custom exporter I wrote, was all very easy. Ping me if you want more info.
www.texturepacker.com/
Note: out of the box texture packer will not help you - the exporter is needed.