Creating @2x graphics with Spine

Just wondering how one goes around catering for this with Spine. Previously when doing animation or graphics I would have 2 versions, the normal and the @2x. Then setting up the config file to detect depending on the resolution of the device which one to use.

Is it possible to create two versions of your skeleton and images in Spine and then have it use the @2x version the same as you would with standard images? If so how do you do it, how do you adjust the scale and images and how do you reference the @2x version then.

Thanks

I am wondering the same thing

We’re also started working with spine. And it’s just awesome…

I’ve looked in the corona runtime and the creation of images is done via display.newImage and not display.newImageRect, so the answer to you question is that it aint supported yet…

We do plan to use @2x images by changing the call to display.newImageRect, and in spine just work with the x1 images.

Once you do that just have the @2x images ready for corona in the same directory and it should work just fine.

In the final product I would go even one step further and just twick the runtime to work with a spritesheet and pack all the images in it.

Hope this helps…

It’s not that it’s not supported, it’s that it’s up to you to change display.newImage to display.newImageRect, as you said. We have had it working for the last month and it works fine, we have spine working with sprite sheets in hi and low res just by changing that function which is supposed to be changed to account for how you want to load the graphics.

Sorry, that’s actually what I meant… I wrote “unsupported” because it is not in the public runtime release… It’s true you can modify the code as you wish and we did it on some other places as well but if the publisher of spine releases an update to the runtime obviously you’ll need to adjust it again…

I am wondering the same thing

We’re also started working with spine. And it’s just awesome…

I’ve looked in the corona runtime and the creation of images is done via display.newImage and not display.newImageRect, so the answer to you question is that it aint supported yet…

We do plan to use @2x images by changing the call to display.newImageRect, and in spine just work with the x1 images.

Once you do that just have the @2x images ready for corona in the same directory and it should work just fine.

In the final product I would go even one step further and just twick the runtime to work with a spritesheet and pack all the images in it.

Hope this helps…

It’s not that it’s not supported, it’s that it’s up to you to change display.newImage to display.newImageRect, as you said. We have had it working for the last month and it works fine, we have spine working with sprite sheets in hi and low res just by changing that function which is supposed to be changed to account for how you want to load the graphics.

Sorry, that’s actually what I meant… I wrote “unsupported” because it is not in the public runtime release… It’s true you can modify the code as you wish and we did it on some other places as well but if the publisher of spine releases an update to the runtime obviously you’ll need to adjust it again…

Great conversation, exactly what I was wanting to know. I’m at a cross roads of going SpriteSheet vs Spine… and if @2x graphics wasn’t do-able in Spine it was a deal breaker. Interestingly it appears that over 2 years on from this post, the spine Corona runtime still uses display.newImage() rather than display.newImageRect() at line 84 of https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-corona/spine-corona/spine.lua

Not sure if this works, but is the only fix the following (I have yet to actually purchase Spine)-  

--Was this.... -- Customizes where images are found. function self:createImage (attachment) return display.newImage(attachment.name .. ".png") end --To This ?.... function self:createImage (attachment) return display.newImageRect(attachment.name .. ".png",attachment.width, attachment.height) end

Cheers in advance!

Try this when creating your spine objects in the skeleton:createImage function:

local imageSuffix = display.imageSuffix function skeleton:createImage (attachment) -- called by spine.lua (function self:createImage (attachment)) if imageSuffix ~= nil then -- does = @2 return display.newImage("spineData/"..dir..attachment.name .."@2.png") else return display.newImage("spineData/"..dir..attachment.name ..".png") end end

Use your own directory there instead of the example provided (“spineData/”…dir…attachment.name …"@2.png").

Thanks kilopop, I will try out that modification! Cheers

Great conversation, exactly what I was wanting to know. I’m at a cross roads of going SpriteSheet vs Spine… and if @2x graphics wasn’t do-able in Spine it was a deal breaker. Interestingly it appears that over 2 years on from this post, the spine Corona runtime still uses display.newImage() rather than display.newImageRect() at line 84 of https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-corona/spine-corona/spine.lua

Not sure if this works, but is the only fix the following (I have yet to actually purchase Spine)-  

--Was this.... -- Customizes where images are found. function self:createImage (attachment) return display.newImage(attachment.name .. ".png") end --To This ?.... function self:createImage (attachment) return display.newImageRect(attachment.name .. ".png",attachment.width, attachment.height) end

Cheers in advance!

Try this when creating your spine objects in the skeleton:createImage function:

local imageSuffix = display.imageSuffix function skeleton:createImage (attachment) -- called by spine.lua (function self:createImage (attachment)) if imageSuffix ~= nil then -- does = @2 return display.newImage("spineData/"..dir..attachment.name .."@2.png") else return display.newImage("spineData/"..dir..attachment.name ..".png") end end

Use your own directory there instead of the example provided (“spineData/”…dir…attachment.name …"@2.png").

Thanks kilopop, I will try out that modification! Cheers