Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CREATE_SCENE_FUNC Macro #13020

Closed
wants to merge 2 commits into from
Closed

Conversation

giginet
Copy link
Contributor

@giginet giginet commented Jul 25, 2015

In common way, we implement createScene method for Layer classes.

This Macro implements the method to get the specific Node as wrapped Scene automatically.

class YourLayer :public cocos2d::Scene
{
  public:
    bool init() override;
    CREATE_SCENE_FUNC(YourLayer);
}
auto scene = YourLayer::createScene();
Director::getIntance()->replaceScene(scene);

This Macro implements the method to get the specific Node as wrapped Scene automatically.

```
class YourLayer :public cocos2d::Scene
{
  public:
    bool init() override;
    CREATE_SCENE_FUNC(YourLayer);
}
```

```
auto scene = YourLayer::createScene();
Director::getIntance()->replaceScene(scene);
```
@pandamicro
Copy link
Contributor

I think this macro is not very appropriate in the engine, we don't want to predict user's behavior because it's not possible, what do you think ? @zilongshanren

@ricardoquesada
Copy link
Contributor

agreed. I don't think it is needed in the engine.

@zilongshanren
Copy link
Member

agreed + 1. We should drop Macros and use template instead.

@pandamicro
Copy link
Contributor

Thanks @ricardoquesada @zilongshanren
@giginet If you think differently, please comment

@pandamicro pandamicro closed this Jul 28, 2015
@giginet giginet deleted the create-scene-func branch July 28, 2015 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants