Button gets bigger when clicked

Hello everyone!
I have the following problem.
I use a class button. I have put two png files for my normal and a pressed button. This pressed button is the same button but 10% smaller.
I follow this tutorial:
https://docs.cocos2d-x.org/cocos2d-x/en/ui_components/buttons.html
Here’s the configuration:
auto pauseButton = cocos2d :: ui :: Button :: create (“blue_pause.png”, “”, “blue_pause_clicked.png”);
The problem is that by pressing the button, it gets bigger instead of smaller.
I also tried the following configuration:
auto pauseButton = cocos2d :: ui :: Button :: create (“blue_pause.png”);
He reacts the same way.
As with:
auto pauseButton = cocos2d :: ui :: Button :: create (“blue_pause.png”, “”, “”);
I also tried:
auto pauseButton = cocos2d :: ui :: Button :: create (“blue_pause.png”, “blue_pause_clicked.png”, “”); - so nothing at all changes. The button remains the same size.
Anyway:
auto pauseButton = cocos2d :: ui :: Button :: create (“blue_pause.png”, “blue_pause_clicked.png”); - nothing changes. The button remains the same size.
Has anyone ever faced this?
I want to make it a little smaller when I press the button.

Use setZoomScale. The default is a positive value, 0.1f, so it enlarges when you click the button. Set it to a negative value to make it reduce in size when clicked.

For your example:

pauseButton->setZoomScale(-0.1f);

3 Likes

Thank you!