cocos2d使用的plist结构

来源:互联网 发布:淘宝小米f码是真的吗 编辑:程序博客网 时间:2024/05/19 10:15

            <key>grossini-arm-l.png</key>            <dict>                <key>frame</key>                <string>{{2,64},{28,26}}</string>                <key>offset</key>                <string>{2,-2}</string>                <key>rotated</key>                <false/>                <key>sourceColorRect</key>                <string>{{4,5},{28,26}}</string>                <key>sourceSize</key>                <string>{32,32}</string>            </dict>


http://gamedev.stackexchange.com/questions/18758/in-cocos2ds-plist-output-what-are-offset-colorsourcerect-and-these-other

frame

The sprite location within the sprite-sheet as position and size values.

offset

Most of the current texture packing tools remove transparent areas of the image before they pack it. Imagine you got a sprite with the size of 100x100, but on the left and right there are 4 columns of totally transparent pixels. The packing tool will remove these to save space, but store offset andsourceSize, so that your sprite will be 100x100 pixels in your game. Note that the offset is always relative to the center of the sprite (comparing the center of the cropped and the center of the original sprite).

rotated

Whether or not the sprite has been rotated within the sprite-sheet (if this is true, the sprite is rotated 90 degrees clockwise).

sourceColorRect

The rectangle with actual color information inside your source sprite. If you take the 100x100 image described above (with 4px transparent pixels on the left and on the right), the sourceColorRect will be {{4,0},{92,100}}

sourceSize

This is the size of the original sprite (beware that some texture-packers can add padding to this if you chose to).


C++解析plist文件

https://github.com/animetrics/PlistCpp



原创粉丝点击