Narendrabrsoft / cocos2d-android-1

Automatically exported from code.google.com/p/cocos2d-android-1
0 stars 0 forks source link

CCSpriteFrameCache and ZwoptexParser #23

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello Zhouweikuan,

I've been doing a example of the class CCSpriteFrameCache (method 
addSpriteFrames(String plist)) and ZwoptexParser (method parseZwoptex(String 
filename)). Both methods have a running good when it using plist files that 
have hosted in asset. 

Could you use these methods have the plist files hosted on the memory card?. If 
so Could you explain how?. 

Thanks and Congratulations for this great work.

Original issue reported on code.google.com by alvaro...@gmail.com on 13 Dec 2010 at 2:47

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I have the same problem. To work with SD I tried to make something like this:

1.- addSpriteFrames(String plist, InputStream is);

2.- addSpriteFrames(String plist, CCTexture2D texture, InputStream is)

3.- public static HashMap parseZwoptex(InputStream is)
        throws Exception {

        System.setProperty("org.xml.sax.driver", "org.xmlpull.v1.sax2.Driver");

        XMLReader xr = XMLReaderFactory.createXMLReader();
        ZwoptexParser handler = new ZwoptexParser();
        xr.setContentHandler(handler);
        xr.setErrorHandler(handler);

        try {
            InputStream in = is
            BufferedReader reader =
                new BufferedReader(new InputStreamReader(in), 8192);
            xr.parse(new InputSource(reader));
            return handler.getResults();
        } catch (Exception e) {
            ccMacros.CCLOGERROR("ZwoptexParser", "Unable to parse plist file.");
        }
        return null;

    }

I have the same problem with CCSprites but using bitmaps it works.

Original comment by manu.msp...@gmail.com on 23 Dec 2010 at 10:15