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

Method SpriteCreation

tests/cpp-tests/Source/RendererTest/RendererTest.cpp:419–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417}
418
419SpriteCreation::SpriteCreation()
420{
421
422 Size s = Director::getInstance()->getWinSize();
423 Node* parent = Node::create();
424 parent->setPosition(s.width / 2, s.height / 2);
425 addChild(parent);
426
427#define KEY_CREATION "11"
428#define KEY_DESTROYATION "22"
429
430 labelCreate = Label::createWithTTF(TTFConfig("fonts/arial.ttf"), "Sprite Creation: ..");
431 labelDestory = Label::createWithTTF(TTFConfig("fonts/arial.ttf"), "Destroy Sprites: ..");
432
433 MenuItemFont::setFontName("fonts/arial.ttf");
434 MenuItemFont::setFontSize(65);
435 auto decrease = MenuItemFont::create(" - ", AX_CALLBACK_1(SpriteCreation::delSpritesCallback, this));
436 decrease->setColor(Color3B(0, 200, 20));
437 auto increase = MenuItemFont::create(" + ", AX_CALLBACK_1(SpriteCreation::addSpritesCallback, this));
438 increase->setColor(Color3B(0, 200, 20));
439
440 auto menu = Menu::create(decrease, increase, nullptr);
441 menu->alignItemsHorizontally();
442 menu->setPosition(Vec2(s.width / 2, s.height - 105));
443 addChild(menu, 1);
444
445 TTFConfig ttfCount("fonts/Marker Felt.ttf", 30);
446 _labelSpriteNum = Label::createWithTTF(ttfCount, "Label");
447 _labelSpriteNum->setColor(Color3B(0, 200, 20));
448 _labelSpriteNum->setPosition(Vec2(s.width / 2, s.height - 130));
449 addChild(_labelSpriteNum);
450
451 updateSpriteCountLabel(totalSprites);
452
453 labelCreate->setPosition(0, -20);
454 labelDestory->setPosition(0, -50);
455
456 parent->addChild(labelCreate);
457 parent->addChild(labelDestory);
458
459 doTest();
460}
461
462void SpriteCreation::updateSpriteCountLabel(int x)
463{

Callers

nothing calls this directly

Calls 9

getInstanceFunction · 0.85
createFunction · 0.85
setFontSizeFunction · 0.85
Color3BFunction · 0.85
Vec2Function · 0.50
setPositionMethod · 0.45
setColorMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected