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

Method updateAtlasValues

core/2d/TileMapAtlas.cpp:227–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227void TileMapAtlas::updateAtlasValues()
228{
229 AXASSERT(_TGAInfo != nullptr, "tgaInfo must be non-nil");
230
231 int total = 0;
232
233 for (int x = 0; x < _TGAInfo->width; x++)
234 {
235 for (int y = 0; y < _TGAInfo->height; y++)
236 {
237 if (total < _itemsToRender)
238 {
239 Color3B* ptr = (Color3B*)_TGAInfo->imageData;
240 Color3B value = ptr[x + y * _TGAInfo->width];
241
242 if (value.r != 0)
243 {
244 this->updateAtlasValueAt(Vec2(x, y), value, total);
245
246 std::string key = StringUtils::toString(x) + "," + StringUtils::toString(y);
247 _posToAtlasIndex[key] = total;
248
249 total++;
250 }
251 }
252 }
253 }
254}
255
256}

Callers 1

initWithTileFileMethod · 0.95

Calls 3

updateAtlasValueAtMethod · 0.95
Vec2Class · 0.70
toStringFunction · 0.50

Tested by

no test coverage detected