| 52 | |
| 53 | |
| 54 | Sprite* searchButton(std::string texture, std::string text, float scale, std::string icon) |
| 55 | { |
| 56 | auto sprite = Sprite::createWithSpriteFrameName(texture); |
| 57 | auto menu = Menu::create(); |
| 58 | |
| 59 | const auto& content_size = sprite->getContentSize(); |
| 60 | auto label = Label::createWithBMFont(GameToolbox::getTextureString("bigFont.fnt"), text); |
| 61 | label->setScale(scale); |
| 62 | menu->addChild(label); |
| 63 | |
| 64 | if (!icon.empty()) |
| 65 | { |
| 66 | auto icon_sprite = Sprite::createWithSpriteFrameName(icon); |
| 67 | icon_sprite->setScale(1.1f); |
| 68 | menu->addChild(icon_sprite); |
| 69 | } |
| 70 | |
| 71 | menu->setPosition(content_size / 2); |
| 72 | menu->alignItemsHorizontally(); |
| 73 | |
| 74 | sprite->addChild(menu); |
| 75 | |
| 76 | return sprite; |
| 77 | } |
| 78 | |
| 79 | Scene* LevelSearchLayer::scene() |
| 80 | { |
no test coverage detected