cocos2d-iphonexamarincocossharp

CCSprite not displayed correctly when using SpriteFrame


My iOS app (build with CocosSharp, Cocos2D port for Xamarin) runs at a design resolution of 640x960 pixels and I have some 64x64 sprites that are loaded from a spritesheet.
I'm using TexturePacker to create spritesheets and I configured it so it doesn't have any spacing between the frames.
Each frame is exactly 64x64 pixels and when I check the spritesheet it looks perfectly fine.

When I try to display CCSprites based on the frames (SpriteFrame) it keeps looking messed up when running on the device (iPhone 4)

If I save each frame as a separate sprite and display them, it works fine, but not when I display them using a SpriteFrame and the spritesheet.

Here is what it looks like on the device:

enter image description here

This is what it looks like in the simulator:

enter image description here

Anyone else experienced this?
All help is much appreciated, I've been stuck with this for a day now!

UPDATE:
Here is a little demo solution that demonstrates the issue (requires Xamarin iOS to build).
You can run it on a simulator or a device, both show the same issue.

SpriteFrame_Issue.zip


Solution

  • I am not tooled to 'play out' csharp ... but : plist ok, texture ok, code looks good. This issue is a 'cropping' issue, not a rendering issue.

    It reminds me of a frequent issue around here for background scrollers, getting a 1 px offset out of nowhere between 2 adjacent textures ! Turned out it is related to 'under the hood' int->float->int conversions, mixed in with scale-ups/scale-downs that end up buying you an extra pixel as offset, from 'float' rounding. Best i can offer is 'go look in the library' for that kind of anomaly, focus on the 'spriteFrame' code base. Hint : the simulator is 64 bits, the iPhone 4 is not.