void ShellExt::insertSubMenuItem(const std::string& text, MenuOp op)
{
    MENUITEMINFO minfo;
    minfo = createMenuItem(text);
    InsertMenuItem (sub_menu_, /* menu */
                    index_++,  /* position */
                    TRUE,      /* by position */
                    &minfo);
    active_menu_items_.push_back(op);
}
	MenuImageItem* ContextMenu::createImageItem(int index)
	{
		MenuImageItemDesc* d = DescManager::getSingletonPtr()->getDefaultMenuImageItemDesc();
		d->resetToDefault();
		
		MenuImageItem* i = dynamic_cast<MenuImageItem*>(createMenuItem(d,index));

		d->resetToDefault();

		return i;
	}
Exemple #3
0
QString TrashPlugin::getMenuContent(QString)
{
    QJsonObject contentObj;

    QJsonArray items;

    items.append(createMenuItem("clear_trash", tr("Empty")));

    contentObj.insert("items", items);

    return QString(QJsonDocument(contentObj).toJson());
}
JNIEXPORT void JNICALL Java_tray_linux_NativeLinuxTray_nativeAddMenuItem0
  (JNIEnv *env, jobject invokingObject, jint nativeId, jint itemIndex, jstring caption)
{
	GtkWidget *menuItem = createMenuItem(env, caption);
	TrayIconInstance * instance = &nativeInstance[nativeId];
	gtk_menu_shell_append (GTK_MENU_SHELL (instance->trayIconMenu), menuItem);

	MenuActivationData * activationData = createActivationData(nativeId, (int)itemIndex);
	g_signal_connect (G_OBJECT (menuItem), "activate", G_CALLBACK (menuItemActivationHandler), (gpointer)activationData);

	gtk_widget_show_all (instance->trayIconMenu);	
}
	MenuImageItem* ContextMenu::createImageItem(const Ogre::String& skin, int index)
	{
		MenuImageItemDesc* d = DescManager::getSingletonPtr()->getDefaultMenuImageItemDesc();
		d->resetToDefault();
		d->widget_skinTypeName = skin;
		
		MenuImageItem* i = dynamic_cast<MenuImageItem*>(createMenuItem(d,index));

		d->resetToDefault();

		return i;
	}
	Menu* ContextMenu::createSubMenu(const Ogre::UTFString& text, int index)
	{
		MenuDesc* d = DescManager::getSingletonPtr()->getDefaultMenuDesc();
		d->resetToDefault();
		d->textDesc.segments.push_back(TextSegment(text));

		Menu* m = dynamic_cast<Menu*>(createMenuItem(d,index));

		d->resetToDefault();

		return m;
	}
	Menu* ContextMenu::createSubMenu(std::vector<TextSegment> segments, int index)
	{
		MenuDesc* d = DescManager::getSingletonPtr()->getDefaultMenuDesc();
		d->resetToDefault();
		d->textDesc.segments = segments;

		Menu* m = dynamic_cast<Menu*>(createMenuItem(d,index));

		d->resetToDefault();

		return m;
	}
Exemple #8
0
GtkWidget *StatusIcon::createMenu() const {
  auto menu = ::gtk_menu_new();

  for (size_t id = 0; id < m_options.size(); ++id) {
    const auto &option = m_options[id];
    auto menuItem = createMenuItem(option.str, option.flags);
    ::gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), menuItem);
    ::g_signal_connect(menuItem,
                       "activate",
                       G_CALLBACK(&StatusIcon::onMenuItem),
                       (gpointer) this);
  }

  ::gtk_widget_show_all(menu);
  return menu;
}
Exemple #9
0
bool SAction::addToMenu(wxMenu* menu, bool show_shortcut, string text_override, string icon_override, int wx_id_offset)
{
	// Can't add to nonexistant menu
	if (!menu)
		return false;

	// Determine shortcut key
	string sc = shortcut;
	bool is_bind = false;
	bool sc_control = shortcut.Contains("Ctrl") || shortcut.Contains("Alt");
	if (shortcut.StartsWith("kb:"))
	{
		is_bind = true;
		keypress_t kp = KeyBind::getBind(shortcut.Mid(3)).getKey(0);
		if (kp.key != "")
			sc = kp.as_string();
		else
			sc = "None";
		sc_control = (kp.ctrl || kp.alt);
	}

	// Setup menu item string
	string item_text = text;
	if (!(S_CMP(text_override, "NO")))
		item_text = text_override;
	if (!sc.IsEmpty() && sc_control)
		item_text = S_FMT("%s\t%s", item_text, sc);

	// Append this action to the menu
	string help = helptext;
	int wid = wx_id + wx_id_offset;
	string real_icon = (icon_override == "NO") ? icon : icon_override;
	if (!sc.IsEmpty()) help += S_FMT(" (Shortcut: %s)", sc);
	if (type == NORMAL)
		menu->Append(createMenuItem(menu, wid, item_text, help, real_icon));
	else if (type == CHECK)
	{
		wxMenuItem* item = menu->AppendCheckItem(wid, item_text, help);
		item->Check(toggled);
	}
	else if (type == RADIO)
		menu->AppendRadioItem(wid, item_text, help);

	return true;
}
ToolDrawCombocontrol::ToolDrawCombocontrol(ToolMenuHandler* toolMenuHandler, ActionHandler* handler, string id)
 : ToolButton(handler, id, ACTION_TOOL_DRAW_RECT, GROUP_RULER, false, "rect-draw.png", _("Draw Rectangle")),
   toolMenuHandler(toolMenuHandler)
{
	XOJ_INIT_TYPE(ToolDrawCombocontrol);

	setPopupMenu(gtk_menu_new());

	drawTypes.push_back(new ToolDrawType(_("Draw Rectangle"),				"rect-draw",					ACTION_TOOL_DRAW_RECT   ));
	drawTypes.push_back(new ToolDrawType(_("Draw Circle"),					"circle-draw",					ACTION_TOOL_DRAW_CIRCLE ));
	drawTypes.push_back(new ToolDrawType(_("Draw Arrow"),					"arrow-draw",					ACTION_TOOL_DRAW_ARROW  ));
	drawTypes.push_back(new ToolDrawType(_("Draw Line"),					"ruler",						ACTION_RULER            ));
	drawTypes.push_back(new ToolDrawType(_("Draw coordinate system"),		"coordinate-system-draw",		ACTION_TOOL_DRAW_COORDINATE_SYSTEM  ));
	drawTypes.push_back(new ToolDrawType(_("Stroke recognizer"),			"shape_recognizer",				ACTION_SHAPE_RECOGNIZER ));

	for (ToolDrawType* t : drawTypes)
	{
		createMenuItem(t->name, t->icon, t->type);
	}
}
int TSContextMenu::Register(QObject* p, PluginMenuType type, QString text, QString icon)
{
    if (m_isInit)
        return -1;

//    ContextMenuInterface *iContextMenu = qobject_cast<ContextMenuInterface *>(p);
//    if (!iContextMenu)
//        return -1;

//    TSLogging::Print(QString("TSContextMenu Registering: %1 %2").arg(p->objectName()).arg(text),LogLevel_DEBUG);

    QString trans = Translator::instance()->translator->translate("context_menu", text.toLatin1().constData());

//    m_Callbacks.append(QPointer<QObject>(p));
//    TSLogging::Print(QString("(TSContextMenu::Register): %1").arg(m_Callbacks.size()),LogLevel_DEBUG);
//    int id = m_Callbacks.size()-1;
    int id = m_Items.size();
    m_Items.append(createMenuItem(type,id,(trans.isEmpty()?text:trans).toLatin1().constData(),icon.toLatin1().constData()));

    return id;
}
Exemple #12
0
bool SAction::addToMenu(wxMenu* menu, bool menubar, string text_override)
{
	// Can't add to nonexistant menu
	if (!menu)
		return false;

	// Determine shortcut key
	string sc = shortcut;
	bool is_bind = false;
	if (shortcut.StartsWith("kb:"))
	{
		is_bind = true;
		keypress_t kp = KeyBind::getBind(shortcut.Mid(3)).getKey(0);
		if (kp.key != "")
			sc = kp.as_string();
	}

	// Setup menu item string
	string item_text = text;
	if (!(S_CMP(text_override, "NO")))
		item_text = text_override;
	if (!sc.IsEmpty() && (!is_bind || !menubar))
		item_text = S_FMT("%s\t%s", item_text, sc);

	// Append this action to the menu
	string help = helptext;
	if (!sc.IsEmpty()) help += S_FMT(" (Shortcut: %s)", sc);
	if (type == NORMAL)
		menu->Append(createMenuItem(menu, wx_id, item_text, help, icon));
	else if (type == CHECK)
	{
		wxMenuItem* item = menu->AppendCheckItem(wx_id, item_text, help);
		item->Check(toggled);
	}
	else if (type == RADIO)
		menu->AppendRadioItem(wx_id, item_text, help);

	return true;
}
Exemple #13
0
/* SAction::addToMenu
 * Adds this action to [menu]. If [text_override] is not "NO", it
 * will be used instead of the action's text as the menu item label
 *******************************************************************/
bool SAction::addToMenu(wxMenu* menu, string text_override)
{
	// Can't add to nonexistant menu
	if (!menu)
		return false;

	// Setup menu item string
	string item_text = text;
	if (!(S_CMP(text_override, "NO")))
		item_text = text_override;
	if (!shortcut.IsEmpty())
		item_text = S_FMT("%s\t%s", CHR(item_text), CHR(shortcut));

	// Append this action to the menu
	if (type == NORMAL)
		menu->Append(createMenuItem(menu, wx_id, item_text, helptext, icon));
	else if (type == CHECK)
		menu->AppendCheckItem(wx_id, item_text, helptext);
	else if (type == RADIO)
		menu->AppendRadioItem(wx_id, item_text, helptext);

	return true;
}
Exemple #14
0
void StoreLayer::initMenu()
{
	Size size = Director::getInstance()->getVisibleSize();
	menu = Node::create();
	this->addChild(menu);
	//ÓÑÇé³é½±
	auto raffle_friend_Item = createMenuItem("raffle_friend.png");
	raffle_friend_Item->setCallback([](Ref* pSender){
		Director::getInstance()->pushScene(RaffleOneLayer::createScene());
	});

	//±¦Ê¯³é½±
	auto raffle_diamond_Item = createMenuItem("raffle_diamond.png");
	raffle_diamond_Item->setCallback([](Ref* pSender){
		Director::getInstance()->pushScene(RaffleTenLayer::createScene());
	});


	//µÚÒ»ÅŲ˵¥
	auto menu_row1 = Menu::create(raffle_friend_Item, raffle_diamond_Item, NULL);
	menu_row1->alignItemsHorizontallyWithPadding(30);
	menu_row1->setPosition(size.width/2, size.height/2 + 110);
	menu->addChild(menu_row1);

	//¹ºÂòÌåÁ¦
	auto  buy_str_Item = createMenuItem("text_buy_str.png");
	buy_str_Item->setCallback([this](Ref* pSender){
		createDialog("store_buy_str");
	});


	//¹ºÂò±³°ü
	auto buy_bag_Item = createMenuItem("text_buy_bag.png");
	buy_bag_Item->setCallback([this](Ref* pSender){
		createDialog("store_buy_bag");
	});

	//µÚ¶þÅŲ˵¥
	auto menu_row2 = Menu::create(buy_str_Item, buy_bag_Item, NULL);
	menu_row2->alignItemsHorizontallyWithPadding(30);
	menu_row2->setPosition(size.width/2, size.height/2 + 10);
	menu->addChild(menu_row2);

	//¹ºÂòPVP
	auto buy_pvp_item = createMenuItem("text_buy_pvp.png");
	buy_pvp_item->setCallback([](Ref* pSender){

	});
	
	//ºÃÓÑÉÏÏÞ
	auto friend_number_Item = createMenuItem("text_friend_number.png");
	friend_number_Item->setCallback([this](Ref* pSender){
		createDialog("store_friend_number");
	});

	auto menu_row3 = Menu::create(buy_pvp_item, friend_number_Item, NULL);
	menu_row3->alignItemsHorizontallyWithPadding(30);
	menu_row3->setPosition(size.width/2, size.height/2 - 90);
	menu->addChild(menu_row3);

	//¹ã¸æ
	auto raffle_ad = Sprite::create("ui/raffle_ad.png");
	raffle_ad->setPosition(size.width/2, size.height/2-220);
	menu->addChild(raffle_ad);
}
GUI* GOFactory::CreateGUI(GameStats* p_gameStats)
{
	float fw = 1.0f/1920.0f;
	float fh = 1.0f/1080.0f;
	float scrW = GAME_FAIL;
	float scrH = GAME_FAIL;
	float guiHeight = 0.08f;
	if(m_io != NULL)
	{
		scrW = (float)m_io->getScreenWidth();
		scrH = (float)m_io->getScreenHeight();
	}

	float heightFraction = m_io->getScreenHeight() / 1080.0f;
	float widthFraction = m_io->getScreenWidth() / 1920.0f;
	int height = m_io->getScreenHeight();

	Rect guiRect(0, 0, m_io->getScreenWidth(),
		(int)(guiHeight) * m_io->getScreenHeight());

	vector<SpriteInfo*> lives;
	for (int i = 0; i < 3; i++)
	{
		fVector2 size = fVector2(50*widthFraction, 50*heightFraction);
		fVector3 pos = fVector3(1.1f * size.x * i + size.x*0.5f, height - 0.08f * height*0.5f, 0.9f); 

		Rect r;
		r.x		= 0;
		r.y		= 0;
		r.width = 39;
		r.height = 28;
		lives.push_back(CreateSpriteInfo("../Textures/life.png",
			pos, size, &r));
	}

	fVector2 size = fVector2(50/scrW, 50/scrH);
	size = fVector2(0,0);
	fVector3 pos = fVector3(0.3f, 1 - guiHeight*0.25f, 0.9f); 
	string texts = "ELAPSED TIME:    ";
	float fontSize = 32.0f;
	fVector2 fontSizeScaled(fontSize*fw, fontSize*fh); 
	MenuItem* elapsed = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Added by Anton

	//Par time
	pos = fVector3(0.3f, 1 - guiHeight*0.75f, 0.9f); 
	texts = "PAR TIME    :    ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	MenuItem* par = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Score
	pos = fVector3(0.6f, 1 - guiHeight*0.25f, 0.9f); 
	texts = "SCORE      :      ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	MenuItem* score = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Total Score
	pos = fVector3(0.6f, 1 - guiHeight*0.75f, 0.9f); 
	texts = "TOTAL SCORE:      ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	MenuItem* totalscore = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Victory

	VictoryStruct victoryData;

	pos = fVector3(0.5f, 0.7f, 0.9f); 
	texts = "VICTORY           ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	victoryData.victory = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.6f, 0.9f); 
	texts = "BASE SCORE:       ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	victoryData.baseScore = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.5f, 0.9f); 
	texts = "MULTIPLIER        ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	victoryData.multiplier = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.4f, 0.9f); 
	texts = "FINAL SCORE:      ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	victoryData.finalScore = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Pause

	PauseStruct pauseData;
	pos = fVector3(0.5f, 0.7f, 0.9f); 
	texts = "GAME PAUSED";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	pauseData.paused = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.6f, 0.9f); 
	texts = "PRESS P TO UNPAUSE";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	pauseData.pressToPlay = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Defeat
	DefeatStruct defeatData;

	pos = fVector3(0.5f, 0.7f, 0.9f); 
	texts = "DEFEAT";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	defeatData.defeated = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.6f, 0.9f); 
	texts = "CONTINUE WILL COST HALF YOUR TOTAL SCORE";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	defeatData.cost = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//End added by Anton

	//Press enter to continue
	ContinueStruct continueStruct;

	pos = fVector3(0.5f,0.2f,0.9f);
	texts = "PRESS ENTER TO CONTINUE!";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh);
	continueStruct.pressToContinue = createMenuItem(
			pos, fVector2(0,0),
			texts,fVector2(0,0), fontSizeScaled,"" );

	pos = fVector3(0.5f,0.2f,0.9f);
	texts = "PRESS ENTER TO CONTINUE OR ESC TO QUIT!";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh);
	continueStruct.pressToEnd = createMenuItem(
			pos, fVector2(0,0),
			texts,fVector2(0,0), fontSizeScaled,"" );


	// Item slots: Speed and Bomb.
	pos		= fVector3(1 - 350/1920.0f, 1 - guiHeight*0.5f, 0.9f);
	size	= fVector2(64*widthFraction, 64*heightFraction);
	string ytext = "Z";
	MenuItem* y = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			ytext, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3((1920-300)*widthFraction, height - 0.08f * height*0.5f, 0.9f); 
	SpriteInfo* bomb = CreateSpriteInfo("../Textures/buffguislot.png",
		pos, size, NULL);

	pos.z = pos.z + 0.01f;
	SpriteInfo* speedIcon = CreateSpriteInfo("../Textures/speedpowerup.png", pos,size,NULL);

	pos = fVector3(1 - 200/1920.0f, 1 - guiHeight*0.5f, 0.9f); 
	string xtext = "X";
	MenuItem* x = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			xtext, fVector2(0.0f, 0.0f), fontSizeScaled,"" );
	
	pos = fVector3((1920-150)*widthFraction, height - 0.08f * height * 0.5f, 0.9f);
	SpriteInfo* speed = CreateSpriteInfo("../Textures/itemguislot.png",
		pos, size, NULL);

	pos.z = pos.z + 0.01f;
	SpriteInfo* bombIcon = CreateSpriteInfo("../Textures/bombitem.png",pos,size,NULL);

	return new GUI(	p_gameStats, lives, elapsed, score, par, totalscore, victoryData, 
					pauseData, defeatData, x, y, speed, bomb, bombIcon, speedIcon, 
					continueStruct);
}
Exemple #16
0
//配置菜单的UI
void MainUILayer::configureMenuUI()
{
	Size size = Director::getInstance()->getVisibleSize();
	menu = Node::create();
	this->addChild(menu);

	//英雄
	auto card_item = createMenuItem("button_little_", "text_card.png");
	card_item->setCallback([this](Ref* pSender){
		log("hero menu");
		removeMainUI();
		showCardUI();
	});

	//进化
	auto cardevolve_item = createMenuItem("button_little_", "text_cardevolve.png");
	cardevolve_item->setCallback([this](Ref* pSender){
		log("evolute menu");
		removeMainUI();
		showCardEvolveUI();
	});

	//第一排菜单
	auto menu_row1 = Menu::create(card_item, cardevolve_item, NULL);
	menu_row1->alignItemsHorizontallyWithPadding(30);
	menu_row1->setPosition(size.width /2, size.height/2 - 70);
	menu->addChild(menu_row1);

	//碎片
	auto chip_item = createMenuItem("button_little_", "text_chip.png");
	chip_item->setCallback([this](Ref* pSender){
		log("chip menu");
		removeMainUI();
		showChipUI();
	});

	//升级
	auto mix_item = createMenuItem("button_little_", "text_mix.png");
	mix_item->setCallback([this](Ref* pSender){
		log("mix menu");
		removeMainUI();
		showCardLevelupUI();
	});

	//第二排菜单
	auto menu_row2 = Menu::create(chip_item, mix_item, NULL);
	menu_row2->alignItemsHorizontallyWithPadding(30);
	menu_row2->setPosition(size.width /2, size.height/2 - 175);
	menu->addChild(menu_row2);

	//奖励
	auto task_item = createMenuItem("button_little_", "text_tast.png");
	task_item->setCallback([this](Ref* pSender){
		log("task menu");
		removeMainUI();
		showTaskUI();
	});

	//技能学院
	auto colleage_item = createMenuItem("button_little_", "text_colleage.png");
	colleage_item->setCallback([this](Ref* pSender){
		log("college menu");
		removeMainUI();
		showColleageUI();
	});

	//第一排菜单
	auto menu_row3 = Menu::create(task_item, colleage_item, NULL);
	menu_row3->alignItemsHorizontallyWithPadding(30);
	menu_row3->setPosition(size.width /2, size.height/2 - 280);
	menu->addChild(menu_row3);
	
}
Exemple #17
0
void CardLevelUpLayer::initframe()
{
	Size size = Director::getInstance()->getVisibleSize();

	//背景
	auto bg = Sprite::create("ui/background_2.jpg");
	bg->setScale(1.26f);
	bg->setPosition(size.width/2, 760);
	this->addChild(bg);

	//底部背景
	auto bottom_list = Sprite::createWithSpriteFrameName("bottom_list.jpg");
	bottom_list->setPosition(size.width/2, bottom_list->getContentSize().height/2);
	this->addChild(bottom_list);

	//升级背景
	auto listbase = Sprite::create("ui/eatcardbase.jpg");  
	listbase->setScale(1.4f);
	listbase->setPosition(size.width/2, 410);
	this->addChild(listbase);

	//顶部文字的背景
	auto middletitlebase = Sprite::createWithSpriteFrameName("middletitlebase.png");
	middletitlebase->setPosition(size.width/2, 700);
	this->addChild(middletitlebase);

	//顶部的文字
	auto titletext = Sprite::createWithSpriteFrameName("titlename_eatcard.png");
	titletext->setPosition(size.width/2, 690);
	this->addChild(titletext);

	//顶部返回按钮
	auto button_left_normal = Sprite::createWithSpriteFrameName("button_left_0.png");
	auto button_left_pressed = Sprite::createWithSpriteFrameName("button_left_1.png");
	auto button_left_disable = Sprite::createWithSpriteFrameName("button_left_2.png");
	auto menuItem = MenuItemSprite::create(button_left_normal, button_left_pressed, button_left_disable);
	menuItem->setCallback([](Ref* pSender){
		log("return");
		NotificationCenter::getInstance()->postNotification("ReturnToMain");
	});

	auto text_return = Sprite::createWithSpriteFrameName("text_return.png");
	text_return->setPosition(button_left_normal->getContentSize().width/2, button_left_normal->getContentSize().height/2);
	menuItem->addChild(text_return);

	auto menu_left = Menu::create(menuItem, NULL);
	menu_left->setPosition(menuItem->getContentSize().width/2 - 10, 687);
	this->addChild(menu_left);

	//英雄升级框
	card_levelup_base = Sprite::createWithSpriteFrameName("bigcard_empty.png");
	card_levelup_base->setPosition(size.width/2, 530);
	this->addChild(card_levelup_base);

	//英雄升级属性背景
	card_levelup_pro_base = Sprite::createWithSpriteFrameName("cardinfobase.png");
	card_levelup_pro_base->setPosition(size.width/2, 350);
	this->addChild(card_levelup_pro_base);

	//左边三排背景框
	left_eated_01_bk = Sprite::createWithSpriteFrameName("littlecard_empty.png");
	left_eated_02_bk = Sprite::createWithSpriteFrameName("littlecard_empty.png");
	left_eated_03_bk = Sprite::createWithSpriteFrameName("littlecard_empty.png");
	left_eated_01_bk->setPosition(120, 580);
	left_eated_02_bk->setPosition(120, 480);
	left_eated_03_bk->setPosition(120, 380);
	this->addChild(left_eated_01_bk);
	this->addChild(left_eated_02_bk);
	this->addChild(left_eated_03_bk);

	//右边三排背景框
	right_eated_01_bk = Sprite::createWithSpriteFrameName("littlecard_empty.png");
	right_eated_02_bk = Sprite::createWithSpriteFrameName("littlecard_empty.png");
	right_eated_03_bk = Sprite::createWithSpriteFrameName("littlecard_empty.png");
	right_eated_01_bk->setPosition(520, 580);
	right_eated_02_bk->setPosition(520, 480);
	right_eated_03_bk->setPosition(520, 380);
	this->addChild(right_eated_01_bk);
	this->addChild(right_eated_02_bk);
	this->addChild(right_eated_03_bk);

	//消耗值框
	need_eat_pro_base = Sprite::createWithSpriteFrameName("eatcard_base2.png");
	need_eat_pro_base->setScale(2.0f);
	need_eat_pro_base->setPosition(size.width/2, 245);
	this->addChild(need_eat_pro_base);

	//选择吞噬英雄按钮,将角色放入卡框里
	choose_food_Item = createMenuItem("button_little_", "text_food.png");
	choose_food_Item->setCallback(CC_CALLBACK_1(CardLevelUpLayer::choose_food_menucalback, this));
	choose_food_Item->setScale(0.8f);
	auto menu_choose_food = Menu::create(choose_food_Item, NULL);
	menu_choose_food->setPosition(size.width/2 - 150, 183);
	this->addChild(menu_choose_food);

	//升级按钮
	startlevel_Item = createMenuItem("button_little_", "text_stareat.png");
	startlevel_Item->setScale(0.8f);
	startlevel_Item->setCallback(CC_CALLBACK_1(CardLevelUpLayer::start_update_level_menucallback,this));
	auto menu_start_level = Menu::create(startlevel_Item, NULL);
	menu_start_level->setPosition(size.width/2 + 150, 183);
	this->addChild(menu_start_level);
	startlevel_Item->setEnabled(false);
}
Exemple #18
0
void menuInit()
{
    createMenuItem(miDrive, strDrive, &miConfig, &miProfiles, NULL_ENTRY,
                    NULL_ENTRY, changeMode, DRIVE_MODE);
    createMenuItem(miProfiles, strProfiles, &miDrive, &miMouse, NULL_ENTRY,
                    &miOutFast, NULL_FUNC);
    createMenuItem(miMouse, strMouse, &miProfiles, &miIr, NULL_ENTRY,
                    NULL_ENTRY, changeMode, MOUSE_MODE);
    createMenuItem(miIr, strIr, &miMouse, &miConfig, NULL_ENTRY,
                    &miDev1, NULL_FUNC);
    createMenuItem(miConfig, strConfig, &miIr, &miDrive, NULL_ENTRY,
                    &miConfUnlock, NULL_FUNC);

    createMenuItem(miOutFast, strOutFast, &miInSlow, &miOutSlow, &miProfiles,
                    NULL_ENTRY, changeProfile, PROF_OUT_FAST, false);
    createMenuItem(miOutSlow, strOutSlow, &miOutFast, &miInFast, &miProfiles,
                    NULL_ENTRY, changeProfile, PROF_OUT_SLOW, false);
    createMenuItem(miInFast, strInFast, &miOutSlow, &miInSlow, &miProfiles,
                    NULL_ENTRY, changeProfile, PROF_IN_FAST, true);
    createMenuItem(miInSlow, strInSlow, &miInFast, &miCustom1, &miProfiles,
                    NULL_ENTRY, changeProfile, PROF_IN_SLOW, false);
    createMenuItem(miCustom1, strCustom1, &miInSlow, &miOutFast, &miProfiles,
                    NULL_ENTRY, changeProfile, PROF_CUSTOM_1, false);


    createMenuItem(miDev1, strIrDev1, &miDev3, &miDev2, &miIr,
                    &miDev1Sig1, NULL_FUNC);
    createMenuItem(miDev2, strIrDev2, &miDev1, &miDev3, &miIr,
                    &miDev2Sig1, NULL_FUNC);
    createMenuItem(miDev3, strIrDev3, &miDev2, &miDev1, &miIr,
                    &miDev3Sig1, NULL_FUNC);

    createMenuItem(miDev1Sig1, strIrSig1, &miDev1Rec, &miDev1Sig2, &miDev1,
                    NULL_ENTRY, sendIrTxMsg, 0);
    createMenuItem(miDev1Sig2, strIrSig2, &miDev1Sig1, &miDev1Sig3, &miDev1,
                    NULL_ENTRY, sendIrTxMsg, 1);
    createMenuItem(miDev1Sig3, strIrSig3, &miDev1Sig2, &miDev1Rec, &miDev1,
                    NULL_ENTRY, sendIrTxMsg, 2);
    createMenuItem(miDev1Rec, strIrRec, &miDev1Sig3, &miDev1Sig1, &miDev1,
                    &miDev1Sig1Rec, NULL_FUNC);

    createMenuItem(miDev1Sig1Rec, strIrSig1, &miDev1Sig3Rec, &miDev1Sig2Rec, &miDev1Rec,
                    NULL_ENTRY, sendIrRxMsg, 0);
    createMenuItem(miDev1Sig2Rec, strIrSig2, &miDev1Sig1Rec, &miDev1Sig3Rec, &miDev1Rec,
                    NULL_ENTRY, sendIrRxMsg, 1);
    createMenuItem(miDev1Sig3Rec, strIrSig3, &miDev1Sig2, &miDev1Sig1Rec, &miDev1Rec,
                    NULL_ENTRY, sendIrRxMsg, 2);

    createMenuItem(miDev2Sig1, strIrSig1, &miDev2Rec, &miDev2Sig2, &miDev2,
                    NULL_ENTRY, sendIrTxMsg, 0);
    createMenuItem(miDev2Sig2, strIrSig2, &miDev2Sig1, &miDev2Sig3, &miDev2,
                    NULL_ENTRY, sendIrTxMsg, 1);
    createMenuItem(miDev2Sig3, strIrSig3, &miDev2Sig2, &miDev2Sig1, &miDev2,
                    NULL_ENTRY, sendIrTxMsg, 2);
    createMenuItem(miDev2Rec, strIrRec, &miDev2Sig3, &miDev2Sig1, &miDev2,
                    &miDev2Sig1Rec, NULL_FUNC);

    createMenuItem(miDev2Sig1Rec, strIrSig1, &miDev2Sig3Rec, &miDev2Sig2Rec, &miDev2Rec,
                    NULL_ENTRY, sendIrRxMsg, 0);
    createMenuItem(miDev2Sig2Rec, strIrSig2, &miDev2Sig1Rec, &miDev2Sig3Rec, &miDev2Rec,
                    NULL_ENTRY, sendIrRxMsg, 1);
    createMenuItem(miDev2Sig3Rec, strIrSig3, &miDev2Sig2, &miDev2Sig1Rec, &miDev2Rec,
                    NULL_ENTRY, sendIrRxMsg, 2);

    createMenuItem(miDev3Sig1, strIrSig1, &miDev3Rec, &miDev3Sig2, &miDev3,
                    NULL_ENTRY, sendIrTxMsg, 20);
    createMenuItem(miDev3Sig2, strIrSig2, &miDev3Sig1, &miDev3Sig3, &miDev3,
                    NULL_ENTRY, sendIrTxMsg, 21);
    createMenuItem(miDev3Sig3, strIrSig3, &miDev3Sig2, &miDev3Sig1, &miDev3,
                    NULL_ENTRY, sendIrTxMsg, 22);
    createMenuItem(miDev3Rec, strIrRec, &miDev3Sig3, &miDev3Sig1, &miDev3,
                    &miDev3Sig1Rec, NULL_FUNC);

    createMenuItem(miDev3Sig1Rec, strIrSig1, &miDev3Sig3Rec, &miDev3Sig2Rec, &miDev3Rec,
                    NULL_ENTRY, sendIrRxMsg, 0);
    createMenuItem(miDev3Sig2Rec, strIrSig2, &miDev3Sig1Rec, &miDev3Sig3Rec, &miDev3Rec,
                    NULL_ENTRY, sendIrRxMsg, 1);
    createMenuItem(miDev3Sig3Rec, strIrSig3, &miDev3Sig2, &miDev3Sig1Rec, &miDev3Rec,
                    NULL_ENTRY, sendIrRxMsg, 2);

    createMenuItem(miConfUnlock, strConfUnlock, NULL_ENTRY, NULL_ENTRY, &miConfig,
                    NULL_ENTRY, changeMode, CONFIG_MODE);

    createMenuItem(miConfLock, strConfLock, &miCustomProfile, &miConfClk, &miConfig,
                    NULL_ENTRY, changeMode, CONFIG_MODE);
    createMenuItem(miConfClk, strConfClk, &miConfLock, &miConfClkRes, &miConfig,
                    NULL_ENTRY, showUsageTime);
    createMenuItem(miConfClkRes, strConfClkRes, &miConfClk, &miCustomProfile, &miConfig,
                    NULL_ENTRY, resetUsageTime);
    createMenuItem(miCustomProfile, strCustomProfile, &miConfClkRes, &miConfLock, &miConfig,
                    NULL_ENTRY, changeMode, PROFILES_MODE);
}