Forums » C# Framework » {SOLVED}SpriteSheets and plists not being read correctly? »
| C. A. | {SOLVED}SpriteSheets and plists not being read correctly? | ||||
|---|---|---|---|---|---|
|
Hi, I'm porting a game project from cocos2d-x for iPhone and I ran into a problem while working with spritesheets. All spritesheets were made with TexturePacker using the "allow rotation" option wich means that all the frames are squished together to save memory ( more info here: http://www.raywenderlich.com/2361/how-to-create-and-optimize-sprite-sheets-in-cocos2d-with-texture-packer-and-pixel-formats ). Using these spritesheets works fine on cocos2d-x iphone and android as they can handle the rotation and position the frame correctly, but the XNA version does not, and the frames are shown without the correct rotation. I don't know if this is a mistake of cocos2d XNA, or it was never meant to work with this kind of spritesheets. That would mean I have to repack every spritesheet differently and I would rather avoid that. Any guidance is appreciated. |
||||
| C. A. | RE: SpriteSheets and plists not being read correctly? | ||||
|
Well, it seems it was an error with cocos2d XNA, because the .plist parser skips over the "rotated" propriety.
if (name == "key" || name == "integer" || name == "real" || name == "string")
{
string value = xmlReader.ReadElementContentAsString();
buffer = Encoding.UTF8.GetBytes(value);
textHandler(this, buffer, buffer.Length);
endElement(this, name);
}
into
if (name == "key" || name == "integer" || name == "real" || name == "string" || name == "true" || name == "false")
{
string value = xmlReader.ReadElementContentAsString();
buffer = Encoding.UTF8.GetBytes(value);
textHandler(this, buffer, buffer.Length);
endElement(this, name);
}
|
||||
| Jacob Anderson | RE: {SOLVED}SpriteSheets and plists not being read correctly? | ||||
|
Added by Jacob Anderson 10 months ago
bump. I will look at this tomorrow to get into the next minor release. Target: 0.1.3a (if it's not alread in 0.1.2a). |
||||
| Jacob Anderson | RE: {SOLVED}SpriteSheets and plists not being read correctly? | ||||
|
Added by Jacob Anderson 10 months ago
This will go into 0.1.3a. There are some issues with the sax parser and plist data. For one, the "endElement" handler is called twice for every handled element. Next, there is no state management so you don't have to use the "dict" tag to enclose your dictionary attributes. |
(1-3/3)