Display dialog on a Scene

I’m newbie in Cocos2d-x.
I have a ABCScene, in this, i want to display a dialog or something else to tell player that they finish the game level.It also have button “Replay” + “Next” How can i do that.

Any idea will be appreciate. Thanks for all your help.

I don’t know if cocos has built in dialogues but what about a having a layer with the text / buttons on.

You either create it up front and keep it hidden or just create it when you need it.

You can place it on top of the other layers and center it.

As far as I know, there is no build-in dialogs in cocos2dx. You have to write your own dialogs classes to display messages. It can be a CCNode with some background sprite and buttons as children.

Or even a CCLayer, would work although a CCNode would work too.

Adam Reed wrote:

I don’t know if cocos has built in dialogues but what about a having a layer with the text / buttons on.
>
You either create it up front and keep it hidden or just create it when you need it.
>
You can place it on top of the other layers and center it.

I’n newbie, could you please create a simple sample code for that layer

I tried create layer like this:

CCSize winsize = CCDirector::sharedDirector()>getWinSize;
CCSprite *gameOverBg = CCSprite::create;
gameOverBg
>setPosition(ccp(winsize.width/2,winsize.height/2));
gameOverBg~~>setTag;
this~~>addChild(gameOverBg,10);

CCSprite menuItemBtn = CCSprite::create;
CCSprite
menuItemHvr = CCSprite::create(“CloseNormal.png”);

CCMenuItemSprite *menuItem = CCMenuItemSprite::create(menuItemBtn, menuItemHvr, this, menu_selector(HelloWorld::menuCloseCallback));
menuItem~~>setTag;
menuItem~~>setPosition(ccp(gameOverBg~~>getContentSize.width/2~~ 100,gameOverBg~~>getContentSize.height/2+100 ));
gameOverBg~~>addChild(menuItem);
But the button not work, and the Scene behind stills work when i tought.

I don’t know why.

Thanks you very much