:
Because GIF is needed for KD projects, the COCOS2DX itself does not support GIF playback. Baidu + Google for a long time, and ultimately point to https://github.com/opentalking/gif-for-cocos2dx here, but the first to see the time is based on 2.2, because the underlying code is not familiar with, there is no way to start ... So contact the original author, he made a 3.x version of a weekend, we can go to worship https://github.com/opentalking/gif-for-cocos2dx-3.x.git
Here sincerely to the great God of the selfless sharing of the spirit of praise ~
How to use:
pull down, import the GIF folder into the project, then you can use gif~~~
like a sprite.
std::string name =" G2.gif "; name = Fileutils::getinstance (), Fullpathforfilename ( Name.c_str ()); Gifbase *gif = Instantgif::create (Name.c_str ()); Gif->setposition (Point (visiblesize.width * 0.5, Visiblesize.height * 0.5); GIF, Setscale (2); this->addchild (GIF); gif2 = Cachegif::create (Name.c_str ()); gif2- >setposition (Point (500,0)); Gif2->setscale (2); This->addchild (GIF2);
Use of the class is mainly instantgif and cachegif, the use of the same method, the former is playing one side from the data to parse the frame, the latter is a one-time parsing, and put in the cache, this way takes long, occupy memory large (picture frame number too many words may hang), But the first way will be a lot smoother ~
Welcome to my blog: helkyle.tk
COCOS2DX 3.x play GIF using a third-party library