MCPcopy Create free account
hub / github.com/axmolengine/axmol / labelAtlasScaleChangedWithSize

Method labelAtlasScaleChangedWithSize

core/ui/UITextAtlas.cpp:156–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156void TextAtlas::labelAtlasScaleChangedWithSize()
157{
158 if (_ignoreSize)
159 {
160 _labelAtlasRenderer->setScale(1.0f);
161 }
162 else
163 {
164 Vec2 textureSize = _labelAtlasRenderer->getContentSize();
165 if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
166 {
167 _labelAtlasRenderer->setScale(1.0f);
168 return;
169 }
170 float scaleX = _contentSize.width / textureSize.width;
171 float scaleY = _contentSize.height / textureSize.height;
172 _labelAtlasRenderer->setScaleX(scaleX);
173 _labelAtlasRenderer->setScaleY(scaleY);
174 }
175 _labelAtlasRenderer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f);
176}
177
178std::string TextAtlas::getDescription() const
179{

Callers

nothing calls this directly

Calls 5

setScaleMethod · 0.45
getContentSizeMethod · 0.45
setScaleXMethod · 0.45
setScaleYMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected