DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const string& _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) : DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats) { backgroundName = "menubgdeckeditor"; mShowDetailsScreen = false; deckTitle = selectedDeck ? selectedDeck->parent->meta_name : ""; mX = 123; mY = 70; starsOffsetX = 50; //titleX = 110; // center point in title box if(selectedDeck) { titleX = (SCREEN_WIDTH_F/2.f); titleY = 13; } else { titleX = SCREEN_WIDTH_F/6.5f; // center point in title box titleY = 25; } titleWidth = 180; // width of inner box of title descX = 275; descY = 80; descHeight = 154; descWidth = 175; statsHeight = 50; statsWidth = 185; statsX = 280; statsY = 12; avatarX = 222; avatarY = 8; float scrollerWidth = 80; SAFE_DELETE(mScroller); // need to delete the scroller init in the base class mScroller = NEW VerticalTextScroller(Fonts::MAIN_FONT, 40, 230, scrollerWidth, 100); }
DeckMenu::DeckMenu(int id, JGuiListener* listener, int fontId, const string _title, const int&, bool showDetailsOverride) : JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsScreen( showDetailsOverride ) { backgroundName = "DeckMenuBackdrop"; mAlwaysShowDetailsButton = false; mSelectedDeck = NULL; mY = 50; mWidth = 176; mX = 115; titleX = 110; // center point in title box titleY = 15; titleWidth = 180; // width of inner box of title descX = 260 + DeckMenuConst::kDescriptionHorizontalBoxPadding; descY = 100 + DeckMenuConst::kDescriptionVerticalBoxPadding; descHeight = 145; descWidth = 195; detailedInfoBoxX = 400; detailedInfoBoxY = 235; starsOffsetX = 50; statsX = 300; statsY = 15; statsHeight = 50; statsWidth = 227; avatarX = 232; avatarY = 11; menuInitialized = false; float scrollerWidth = 200.0f; float scrollerHeight = 28.0f; mScroller = NEW VerticalTextScroller(Fonts::MAIN_FONT, 14, 235, scrollerWidth, scrollerHeight, DeckMenuConst::kVerticalScrollSpeed); mAutoTranslate = true; maxItems = 6; mHeight = 2 * DeckMenuConst::kVerticalMargin + (maxItems * DeckMenuConst::kLineHeight); // we want to cap the deck titles to 15 characters to avoid overflowing deck names title = _(_title); displayTitle = title; mFont = WResourceManager::Instance()->GetWFont(fontId); startId = 0; selectionT = 0; timeOpen = 0; mClosed = false; if (mFont->GetStringWidth(title.c_str()) > titleWidth) titleFontScale = SCALE_SHRINK; else titleFontScale = SCALE_NORMAL; mSelectionTargetY = selectionY = DeckMenuConst::kVerticalMargin; if (NULL == stars) stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get())); stars->FireAt(mX, mY); const string detailedInfoString = _("Detailed Info"); WFont *descriptionFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); float stringWidth = descriptionFont->GetStringWidth(detailedInfoString.c_str()); float boxStartX = detailedInfoBoxX - stringWidth / 2 + 20; dismissButton = NEW InteractiveButton( this, DeckMenuConst::kDetailedInfoButtonId, Fonts::MAIN_FONT, detailedInfoString, boxStartX, detailedInfoBoxY, JGE_BTN_CANCEL); JGuiController::Add(dismissButton, true); updateScroller(); }