DragonBonesCPP icon indicating copy to clipboard operation
DragonBonesCPP copied to clipboard

How to scale a character?

Open boehm-e opened this issue 5 years ago • 2 comments

Hi :)

I am using the helloDragonBones example, and trying to scale down my character: so i do like that :

factory.loadTextureAtlasData("data/sheep/Sheep_Ani_tex.json", &texture, "",0.5f);

but i got strange results : only one part of the character is scaled, and the armature does not seems to be scaled. So is there a way i haven't seen, for scaling characters ?

Thank you,

image

boehm-e avatar Oct 25 '18 15:10 boehm-e

You have to scale armature in draw function using sf::RenderStates. Example:

sf::RenderStates states;
states.transform.scale(0.5f, 0.5f);
window.draw(*armatureDisplay, states);

Hary309 avatar Oct 25 '18 16:10 Hary309

:+1:

Thank you, I have found another way, which does not involve sfml:

	armatureDisplay->getArmature()->getBone("root")->offset.scaleX = 0.5f;
	armatureDisplay->getArmature()->getBone("root")->offset.scaleY = 0.5f;

boehm-e avatar Oct 25 '18 16:10 boehm-e