本文整理汇总了C++中PopupLayer类的典型用法代码示例。如果您正苦于以下问题:C++ PopupLayer类的具体用法?C++ PopupLayer怎么用?C++ PopupLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PopupLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
PopupLayer* PopupLayer::create(const char *backgroundImage)
{
PopupLayer* ml = PopupLayer::create();
ml->setSpriteBackGround(Sprite::create(backgroundImage));
ml->setSprite9BackGround(Scale9Sprite::create(backgroundImage));
return ml;
}
示例2: PopupLayer
PopupLayer* PopupLayer::create(HelloWorld* const & parent)
{
PopupLayer* pPopupLayer = new PopupLayer(parent);
pPopupLayer->init();
pPopupLayer->autorelease();
return pPopupLayer;
}
示例3: startGame
void MainLayer::startGame()
{
if (isPetOpen(m_petType))
{
CCNotificationCenter::sharedNotificationCenter()->postNotification(
MSG_BUTTON_PRESS_ID, (CCObject *)(CCInteger::create(MSG_ID_STARTLAYER_BUTTON_PRESS)));
}
else
{
int price = s_pet_price[m_petType];
int cherryNum = Config::instance()->cherryNum();
if (cherryNum < price)
{
m_uiLayer->setTouchEnabled(false);
PopupLayer *popLayer = PopupLayer::create();
this->addChild(popLayer);
popLayer->setParam(m_uiLayer);
}
else
{
Config::instance()->useCherry(price);
CCNotificationCenter::sharedNotificationCenter()->postNotification(
MSG_BUTTON_PRESS_ID, (CCObject *)(CCInteger::create(MSG_ID_STARTLAYER_BUTTON_PRESS)));
}
}
}
示例4: toLocal
bool Menubar::_openMenu( int nb )
{
MenuBarItem * pItem = m_items.get(nb-1);
if( pItem == 0 || !pItem->m_pMenu )
return false;
Coord pos = toLocal( Coord(0, 0) );
if( m_pSkin )
pos = m_pSkin->contentRect( pos, StateEnum::Normal ).pos();
int bordersWidth = _getEntryBorder().width();
MenuBarItem * pI = m_items.first();
while( pI != pItem )
{
if( pI->isVisible() )
pos.x += pI->m_width + bordersWidth;
pI = pI->next();
}
Rect r(pos, pI->m_width+bordersWidth, size().h );
PopupLayer * pLayer = 0;
if( parent() )
pLayer = parent()->_getPopupLayer();
if( !pLayer )
return false;
pLayer->openPopup( pItem->m_pMenu, this, r - pLayer->globalPos(), Origo::SouthWest );
return true;
}
示例5: PopupLayer
PopupLayer* PopupLayer::createGameoverLayer(int gameType, int score) {
PopupLayer *layer = new PopupLayer();
if (layer && layer->init()) {
layer->autorelease();
layer->initGameoverLayer(gameType, score);
return layer;
}
CC_SAFE_DELETE(layer);
return NULL;
}
示例6: PopupLayer
PopupLayer* PopupLayer::create(string pBackgroundImage,
string pExitNormalImage,
string pExitSelectedImage,
const Point &pExitPostion) {
PopupLayer *pRet = new PopupLayer();
pRet->init(pBackgroundImage, pExitNormalImage, pExitSelectedImage, pExitPostion);
pRet->autorelease();
return pRet;
}
示例7: create
PopupLayer* PopupLayer::create(const char* backgroundImage, Size dialogSize){
PopupLayer* layer = PopupLayer::create();
// layer->setSpriteBackGround(Sprite::create(backgroundImage));
layer->setSprite9BackGround(Scale9Sprite::create(backgroundImage));
layer->m_dialogContentSize = dialogSize;
return layer;
}
示例8: PopupLayer
PopupLayer* PopupLayer::create(Layer * targetLayer,const int type)
{
PopupLayer* popupLayer = new PopupLayer();
if (popupLayer && popupLayer->init(targetLayer, type))
{
popupLayer->autorelease();
return popupLayer;
}
else
{
CC_SAFE_DELETE(popupLayer);
return nullptr;
}
}
示例9: openBrowser
void WikipediaItem::openBrowser( )
{
if ( m_marbleWidget ) {
PopupLayer* popup = m_marbleWidget->popupLayer();
popup->setCoordinates( coordinate(), Qt::AlignRight | Qt::AlignVCenter );
popup->setSize(QSizeF(520, 570));
popup->setUrl( url() );
popup->popup();
} else {
if ( !m_browser ) {
m_browser = new TinyWebBrowser();
}
m_browser->load( url() );
m_browser->show();
}
}
示例10: openBrowser
void PhotoPluginItem::openBrowser()
{
if ( m_marbleWidget ) {
PopupLayer* popup = m_marbleWidget->popupLayer();
popup->setCoordinates( coordinate(), Qt::AlignRight | Qt::AlignVCenter );
popup->setSize( QSizeF( 700, 450 ) );
popup->setUrl( QUrl( QString( "http://m.flickr.com/photos/%1/%2/" )
.arg( owner() ).arg( id() ) ) );
popup->setVisible( true );
} else {
if( !m_browser ) {
m_browser = new TinyWebBrowser();
}
QString url = "http://www.flickr.com/photos/%1/%2/";
m_browser->load( QUrl( url.arg( owner() ).arg( id() ) ) );
m_browser->show();
}
}
示例11: parent
bool Menubar::_closeMenu( int nb )
{
if( nb == 0 )
return false;
MenuBarItem * pItem = m_items.get(m_selectedItem-1);
if( !pItem || !pItem->m_pMenu )
return false;
PopupLayer * pLayer = 0;
Widget_p pMenu = pItem->m_pMenu;
if( parent() )
pLayer = parent()->_getPopupLayer();
if( !pLayer || !pMenu )
return false;
pLayer->closePopup( pMenu );
return true;
}
示例12: popupLayer
void CollageScene::popupLayer(Node* baseLayer,Vec2 popPos,const char *sTitle,string sContent){
PopupLayer* pl = PopupLayer::create("popup_sq.png");
pl->setContentSize(Size(450, 250));
//auto sizeLayer = baseLayer->getContentSize();
pl->setAnchorPoint(Vec2(.5,.5));
pl->setPosition(popPos.x,popPos.y);
pl->setTitle(sTitle,Color3B(106,72,36));
pl->setContentText(sContent.c_str(),Color3B(106,72,36), 24, 20, 150);
pl->setCallbackFunc(this, callfuncND_selector(CollageScene::popupCallback),NULL);
// 添加按钮,设置图片,文字,tag 信息
pl->addButton("button_normal.png", "button_dis.png", "RETURN",Color3B(255,255,255), 1);
// 添加到指定层
baseLayer->addChild(pl);
}
示例13: popupLayer
void Popup::popupLayer(){
// 定义一个弹出层,传入一张背景图
PopupLayer* pl = PopupLayer::create("popuplayer/BackGround.png");
// ContentSize 是可选的设置,可以不设置,如果设置把它当作 9 图缩放
pl->setContentSize(CCSizeMake(400, 350));
pl->setTitle("Message Tile");
pl->setContentText("Text content test", 20, 60, 250);
// 设置回调函数,回调传回一个 CCNode 以获取 tag 判断点击的按钮
// 这只是作为一种封装实现,如果使用 delegate 那就能够更灵活的控制参数了
pl->setCallbackFunc(this, callfuncN_selector(Popup::buttonCallback));
// 添加按钮,设置图片,文字,tag 信息
pl->addButton("popuplayer/pop_button.png", "popuplayer/pop_button.png", "YES", 0);
pl->addButton("popuplayer/pop_button.png", "popuplayer/pop_button.png", "NO", 1);
// 添加到当前层
this->addChild(pl);
}
示例14: popupLayer
void HelloWorld::popupLayer(){
// 定义一个弹出层,传入一张背景图
PopupLayer* pl = PopupLayer::create("bg.png");
// ContentSize 是可选的设置,可以不设置,如果设置把它当作 9 图缩放
pl->setContentSize(CCSizeMake(400, 280));
// pl->setTitle("吾名一叶");
pl->setContentText("有招聘信息的HR可以联系管理员发群公告!望管理员也给予积极配合,谢谢!群号:389970612 C/C++/OC/C#/JAVA/PHP/SQL....", 12, 10, 250);
pl->setColor(Color3B(250, 60, 60));
// 设置回调函数,回调传回一个 CCNode 以获取 tag 判断点击的按钮
// 这只是作为一种封装实现,如果使用 delegate 那就能够更灵活的控制参数了
pl->setCallbackFunc(this, callfuncN_selector(HelloWorld::buttonCallback));
// 添加按钮,设置图片,文字,tag 信息
pl->addButton("bt1.png", "bt2", "确定", 0);
pl->addButton("bt1.png", "bt2.png", "取消", 1);
// 添加到当前层
this->addChild(pl);
}
示例15: CCMessageBox
void HelloWorld::keyBackClicked() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
CCMessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert");
#else
PopupLayer* pl = PopupLayer::create("pop_bg.png");
// ContentSize 是可选的设置,可以不设置,如果设置把它当作 9 图缩放
pl->setContentSize(CCSizeMake(400, 300));
pl->setTitle("确认");
pl->setContentText("要离开游戏吗?", 28, 60, 250);
// 设置回调函数,回调传回一个 CCNode 以获取 tag 判断点击的按钮
// 这只是作为一种封装实现,如果使用 delegate 那就能够更灵活的控制参数了
pl->setCallbackFunc(this, callfuncN_selector(HelloWorld::popupCallback));
// 添加按钮,设置图片,文字,tag 信息
pl->addButton("pop_button.png", "pop_button.png", "退出", 0);
pl->addButton("pop_button.png", "pop_button.png", "取消", 1);
// 添加到当前层
this->addChild(pl, 5);
#endif
}