| 417 | } |
| 418 | |
| 419 | SpriteCreation::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 | |
| 462 | void SpriteCreation::updateSpriteCountLabel(int x) |
| 463 | { |
nothing calls this directly
no test coverage detected