bool MainMenuPopup::init(bool isStartMenu) { if ( !Layer::init() ) { return false; } Size visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); cocos2d::Vector<cocos2d::MenuItem*> menuItems; Sprite *bg = Sprite::createWithSpriteFrameName("popup_bg.png"); bg->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); this->addChild(bg, -1); initMenuItems(menuItems, "Continue", CC_CALLBACK_1(MainMenuPopup::menuCloseCallback, this)); initMenuItems(menuItems, "Select game", CC_CALLBACK_1(MainMenuPopup::menuSelectGameCallback, this)); initMenuItems(menuItems, "Options", CC_CALLBACK_1(MainMenuPopup::menuOptionsCallback, this)); initMenuItems(menuItems, "Exit", CC_CALLBACK_1(MainMenuPopup::menuExitCallback, this)); if (!isStartMenu) { initMenuItems(menuItems, "Close", CC_CALLBACK_1(MainMenuPopup::menuCloseCallback, this)); } Menu *mainMenu = Menu::createWithArray(menuItems); mainMenu->alignItemsVerticallyWithPadding(10); this->addChild(mainMenu, 1); Sprite *spriteBg = Sprite::createWithSpriteFrameName("menu_bg.png"); spriteBg->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); this->addChild(spriteBg, 0); return true; }
/* Constructors */ ObjectMenu::ObjectMenu(const Point2i &position, unsigned int width, MenuMode mode) : Menu(position, width, TOP | LEFT | RIGHT, mode) { state = DEFAULT_STATE; initMenuItems(); setValues(); }
void ItemEditorWidget::setEditorPalette(const QPalette &palette) { setPalette(palette); if (m_editor) { QPalette pal2 = palette; pal2.setColor(QPalette::Base, Qt::transparent); m_editor->setPalette(pal2); initMenuItems(); } }
/* Constructors */ WheelMenu::WheelMenu(Wheel *wheel, const Point2i &position, unsigned int width, MenuMode mode) : Menu(position, width, BOTTOM | LEFT | RIGHT, mode) { this->wheel = wheel; erased = NULL; initMenuItems(); setValues(); }
/********************* * Setup function * *******************/ void setup() { time_t start, fadeIn, stop, fadeOut; Wire.begin(); setSyncProvider(RTC.get); lcd.init(); lcd.noBacklight(); led.loadEepromDatas(); pinMode(ledPin, OUTPUT); kpd.init(); initMenuItems(); }
int TlenSystemModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam) { TlenProtocol *proto = (TlenProtocol *)ptr; initMenuItems(proto); // updater plugin support if(ServiceExists(MS_UPDATE_REGISTERFL)) { PLUGININFO* pluginInfoPtr = (PLUGININFO*)&pluginInfoEx; #ifdef _UNICODE #ifdef _X64 CallService(MS_UPDATE_REGISTERFL, (WPARAM)4435, (LPARAM)pluginInfoPtr); //x64 version #else CallService(MS_UPDATE_REGISTERFL, (WPARAM)4405, (LPARAM)pluginInfoPtr); //Unicode version #endif #else CallService(MS_UPDATE_REGISTERFL, (WPARAM)4404, (LPARAM)pluginInfoPtr); //ANSI version #endif } return 0; }
void DeckMenu::Render() { JRenderer * renderer = JRenderer::GetInstance(); float height = mHeight; if (!menuInitialized) { initMenuItems(); stars->Fire(); timeOpen = 0; menuInitialized = true; } if (timeOpen < 1) height *= timeOpen > 0 ? timeOpen : -timeOpen; for (int i = startId; i < startId + maxItems; i++) { if (i > mCount - 1) break; DeckMenuItem *currentMenuItem = static_cast<DeckMenuItem*> (mObjects[i]); if (currentMenuItem->getY() - DeckMenuConst::kLineHeight * startId < mY + height - DeckMenuConst::kLineHeight + 7) { // only load stats for visible items in the list DeckMetaData* metaData = currentMenuItem->getMetaData(); if (metaData && !metaData->mStatsLoaded) { metaData->LoadStats(); } if (currentMenuItem->hasFocus()) { mSelectedDeck = metaData; WFont *descriptionFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); // display the "more info" button if special condition is met if (showDetailsScreen()) { dismissButton->setIsSelectionValid(true); dismissButton->Render(); } else { dismissButton->setIsSelectionValid(false); } // display the avatar image string currentAvatarImageName = currentMenuItem->getImageFilename(); if (currentAvatarImageName.size() > 0) { JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad(currentAvatarImageName, TEXTURE_SUB_AVATAR); if(quad.get()) { quad->mWidth = 35.f; quad->mHeight = 50.f; if (currentMenuItem->getText() == "Evil Twin") { JQuad * evil = quad.get(); evil->SetHFlip(true); renderer->RenderQuad(quad.get(), avatarX, avatarY); evil = NULL; } else renderer->RenderQuad(quad.get(), avatarX, avatarY); } } // fill in the description part of the screen string text = wordWrap(_(currentMenuItem->getDescription()), descWidth, descriptionFont->mFontID ); descriptionFont->SetColor(ARGB(255,255,255,255)); descriptionFont->DrawString(text.c_str(), descX, descY); // fill in the statistical portion if (currentMenuItem->hasMetaData()) { ostringstream oss; oss << _("Deck: ") << currentMenuItem->getDeckName() << endl; oss << currentMenuItem->getDeckStatsSummary(); descriptionFont->SetColor(ARGB(255,255,255,255)); descriptionFont->DrawString(oss.str(), statsX, statsY); } // change the font color of the current menu item mFont->SetColor(ARGB(255,255,255,255)); } else // reset the font color to be slightly muted mFont->SetColor(ARGB(150,255,255,255)); currentMenuItem->RenderWithOffset(-DeckMenuConst::kLineHeight * startId); } } if (!title.empty()) { mFont->SetColor(ARGB(255,255,255,255)); mFont->DrawString(title.c_str(), titleX, titleY, JGETEXT_CENTER); } mScroller->Render(); RenderBackground(); RenderDeckManaColors(); renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE); stars->Render(); renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); }