DragonBonesCPP
DragonBonesCPP copied to clipboard
How to scale a character?
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,
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);
:+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;