| 103 | // Create funcs |
| 104 | #pragma region |
| 105 | TextButton* TextButton::create(std::string_view text, std::string_view font, float width, float height, std::string_view bgTexture, std::function<void(TextButton*)> callback) { |
| 106 | auto pRet = new(std::nothrow) TextButton(); |
| 107 | |
| 108 | if (pRet && pRet->init(text, font, width, height, bgTexture, callback)) { |
| 109 | pRet->autorelease(); |
| 110 | return pRet; |
| 111 | } else { |
| 112 | AX_SAFE_DELETE(pRet); |
| 113 | return nullptr; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | TextButton* TextButton::create(std::string_view text, std::function<void(TextButton*)> callback) { |
| 118 | return TextButton::create(text, GameToolbox::getTextureString("goldFont.fnt"), 0, 0, GameToolbox::getTextureString("GJ_button_01.png"), callback); |