ricardoquesada / creator_to_cocos2d

C++ Creator support for Cocos2dx
13 stars 7 forks source link

UIButton-> syntax for creating is incorrect for a plain normal button. #2

Open slackmoehrle opened 8 years ago

slackmoehrle commented 8 years ago

I had a UIButton in a Scene. Rean it through the parser and brought into cpp-tests.

The code it created was:

// New node
auto uibutton_2 = ui::Button::create("None", "", "", ui::Widget::TextureResType::PLIST);

This causes a crash as ui::button::create() has a signature of:

Button* Button::create(const std::string &normalImage,
                       const std::string& selectedImage ,
                       const std::string& disableImage,
                       TextureResType texType)

and the code that was generated contains "None", "", "" meaning valid strings were not passed in. I made this UI Button by simply dragging it to the canvas and changing the text. No other changes. I did this because it looked like a valid button after dragging it to the canvas.

slackmoehrle commented 8 years ago

actually I am wrong a null string should be fine. Notice this code in one of your tests:

// New node
    auto uibutton_1 = ui::Button::create("default_btn_normal", "", "", ui::Widget::TextureResType::PLIST);

This is the same. Yours works, mine doesn't. Switching to your code still causes me a runtime crash.

Here are my properties for the button. screen shot 2016-11-22 at 12 53 59 pm

screen shot 2016-11-22 at 12 58 19 pm

screen shot 2016-11-22 at 12 59 22 pm