Is it possible to get access to the members (elements?) of the object / structure returned by TexturePack:getTextureRegion(texturename).
In particular I'm after the width and height of the region
I'm writing a bitmap font routine and I used the texture packer tool to create a page from all the individual characters but I want to get access to the size of an individual character so I can build up the proportional width tables etc.
I've tried iterating over the table that's returned using pairs() but it just say's the only entry in the table is __userdata and at that point I got stuck? the only other way I can think to access this info is by actually creating an instance of a bitmap from the region - interrogating it's width and then throwing it away but this seems like a lot of overkill and wasteful of time.
Anyone got any suggestions?
Thanks (in advance)
Jon...
WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
#MakeABetterGame! "Never give up, Never
NEVER give up!" -
Winston Churchill
Comments
There is an undocumented function TexturePack:getLocation(texturename), it returns 8 values: x, y, width, height, dx1, dy1, dx2 and dy2. You can safely use this function. (the values dx1, dy1, dx2 and dy2 are used to position a texture region with transparent border. you can simply ignore these)
Also you can look at https://github.com/gideros/bmfont
Hopefully this function won't remain "undocumented" for long
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill