Support cocos2d-x display SVG as sprite or path
ref: NanoSVG ( https://github.com/memononen/nanosvg )
For now it turn SVG to PNG data and create Texture2D from it. So image will break if scale.
Next thing i will add SVGImage to display fully SVG. ( already have but bug )
Setup:
Add source code to your Class folder or anywhere
Using:
#include "SVGSprite.h"
...
SVGSprite* testSVG = SVGSprite::create("tiger.svg", 0.5f);
this->addChild(testSVG);
Link: https://github.com/namkazt/CocosSVGSprite
9 Likes
this is definitely nice feature for the engine, thanks for sharing, looking forward for features.
I know this is a very old thread. Trying my luck to see if there is any update. SVGSprite is great work. I’ve used this in the mac version of my cocos2d-x app. However, I can’t get to compile this for iOS as it complains about not being able to find glfw3.h
. Any pointers?
Perhaps ask in the GitHub repo mentioned above? It isn’t an official Cocos repo.
Thank you. I managed to get it going. glfw3 isn’t really necessary after all
glfw3.h
does not support for ios
what can i do for it??
Thanks in advance
I commented out that include line and it worked. Have you tried that?