How to add gif file

How to add gif file in

To what? To where? What version? What platform? What OS?

In cocos2dx c++, anddroid studio

Are you using cmake? What cocos2d-x version?

yes i am using cmake

where we can see cocos2dx version

You can look in the cocos2d.h

iam using

Add it to your CMakeList.txt file and then use it in code where you need it.

please give me example idont know how to add

Take a look at the file and see what makes sense to you. CMake Tutorial — CMake 3.19.4 Documentation


Like this iwant brother

I don’t understand exactly.

If you have the .gif and want to use it, add it to resources and use it.

If you are looking to create this “bubble effect” I’d use Sprites and Animations to do this. Add the sprites and move them at whatever intervals you like. Maybe even use the particle system.

1 Like


//Like this iam adding its crashing

please give me some example code

Is it added to resources?

What does it say on the console when it crashes?

And it’s a gif. So how are you planning to play it? Sprite doesn’t support gif out of the box.

yes its added in Assets
then how to add gif in cocos2dx c++

You can try using a webP format but I don’t recall if this is supported still.

Just use a Sprite and animations to make your desired effect.

in webp animations how it will come
like gif type

Particals2->setPosition(Vec2(visibleSize.width/768384, visibleSize.height/1024512));

/// i tried like this also bit it is not working