Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Automatic Image Resolution not carried over to texture pack region names — Gideros Forum

Automatic Image Resolution not carried over to texture pack region names

scurvyratscurvyrat Member
edited September 2012 in Bugs and issues
Not saying this is a bug, but rather something that I came across. I just made a set of graphics for iPhone Retina resolution and since my default is 480x320, I was following the suggestion of adding @2x suffix to my filenames.

I made a two sets of graphics and two texture packs, Texture.png and Texture@2x.png. To keep the graphics organized, I appended @2x to the larger version before importing them into the texture creator. The texture creator also made two .txt files for the region coordinates (Texture.txt and Texture@2x.txt). So far so good.

The problem in the code: texturePack:getTextureRegion

While Gideros finds my @2x text PNG file and the associated map TXT file correctly on the iPhone 4s, it does not remap the TextureRegion name to be Button@2x.png.

Again, not saying its a bug, just a gotcha.
texturePack = TexturePack.new("images/Texture.txt","images/Texture.png")
buttonRegion = texturePack:getTextureRegion("Button.png")
button = Bitmap.new(buttonRegion)
So the above is correct for an iPhone, but for the @2x versions Gideros basically does this:
texturePack = TexturePack.new("images/Texture@2x.txt","images/Texture@2x.png")
buttonRegion = texturePack:getTextureRegion("Button.png")
button = Bitmap.new(buttonRegion)
Since, my Retina version of the Button.png is called Button@2x.png when imported into the Texture creator, it chokes with
bad argument #1 to 'new' (TextureBase or TextureRegion expected, got nil)
Maybe I'm doing this all wrong, but it seems the way to do it is to have two directories one for low res and one for the @2x versions. Call the files the same things, just keep them in different directories. Then make your texture and export normal and @2x version.

Comments

Sign In or Register to comment.