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

Method parseCommonArguments

core/2d/FontFNT.cpp:436–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

434}
435
436void BMFontConfiguration::parseCommonArguments(const char* line)
437{
438 //////////////////////////////////////////////////////////////////////////
439 // line to parse:
440 // common lineHeight=104 base=26 scaleW=1024 scaleH=512 pages=1 packed=0
441 //////////////////////////////////////////////////////////////////////////
442
443 // Height
444 auto tmp = strstr(line, "lineHeight=") + 11;
445 sscanf(tmp, "%d", &_commonHeight);
446
447#if _AX_DEBUG > 0
448 // scaleW. sanity check
449 int value;
450 tmp = strstr(tmp, "scaleW=") + 7;
451 sscanf(tmp, "%d", &value);
452
453 int maxTextureSize = Configuration::getInstance()->getMaxTextureSize();
454 AXASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported");
455
456 // scaleH. sanity check
457 tmp = strstr(tmp, "scaleH=") + 7;
458 sscanf(tmp, "%d", &value);
459 AXASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported");
460
461 // pages. sanity check
462 tmp = strstr(tmp, "pages=") + 6;
463 sscanf(tmp, "%d", &value);
464 AXASSERT(value == 1, "CCBitfontAtlas: only supports 1 page");
465#endif
466 // packed (ignore) What does this mean ??
467}
468
469unsigned int BMFontConfiguration::parseCharacterDefinition(const char* line)
470{

Callers 1

parseConfigFileMethod · 0.95

Calls 2

getInstanceFunction · 0.85
getMaxTextureSizeMethod · 0.80

Tested by

no test coverage detected