diff --git a/JGE/include/JTypes.h b/JGE/include/JTypes.h index b4ffe7194..0a7a23766 100644 --- a/JGE/include/JTypes.h +++ b/JGE/include/JTypes.h @@ -165,7 +165,7 @@ typedef uint32_t u32; #if defined (ABGR8888) #ifndef ARGB -#define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (r << 16) | (g << 8) | b) // macro to assemble pixels in correct format +#define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format #endif #define MAKE_COLOR(a, c) (a << 24 | c) #define MASK_ALPHA 0xFF000000 // masks for accessing individual pixels diff --git a/projects/mtg/include/CardDisplay.h b/projects/mtg/include/CardDisplay.h index c282d46a4..56a137fc5 100644 --- a/projects/mtg/include/CardDisplay.h +++ b/projects/mtg/include/CardDisplay.h @@ -23,7 +23,7 @@ public: void rotateRight(); bool CheckUserInput(JButton key); virtual void Update(float dt); - void Render(); + void Render(bool norect = false); void init(MTGGameZone * zone); virtual ostream& toString(ostream& out) const; }; diff --git a/projects/mtg/include/CardPrimitive.h b/projects/mtg/include/CardPrimitive.h index 86b164500..0c2081dbe 100644 --- a/projects/mtg/include/CardPrimitive.h +++ b/projects/mtg/include/CardPrimitive.h @@ -98,7 +98,7 @@ public: int has(int ability); void setText(const string& value); - const vector& getFormattedText(); + const vector& getFormattedText(bool noremove = false); void addMagicText(string value); void addMagicText(string value, string zone); diff --git a/projects/mtg/src/CardDisplay.cpp b/projects/mtg/src/CardDisplay.cpp index 7675763d0..82a427909 100644 --- a/projects/mtg/src/CardDisplay.cpp +++ b/projects/mtg/src/CardDisplay.cpp @@ -234,11 +234,34 @@ bool CardDisplay::CheckUserInput(JButton key) return false; } -void CardDisplay::Render() +void CardDisplay::Render(bool norect) { - + //norect - code shop + WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); JRenderer * r = JRenderer::GetInstance(); - r->DrawRect(static_cast (x), static_cast (y), static_cast (nb_displayed_items * 30 + 20), 50, + //if(norect) + // r->FillRect(0,0,SCREEN_WIDTH_F,SCREEN_HEIGHT_F,ARGB(180,5,5,5)); + + if(norect) + { + //info + r->FillRect(static_cast (x), static_cast (10), static_cast (nb_displayed_items * 30 + 20), 192, + ARGB(200,5,5,5)); + r->DrawRect(static_cast (x), static_cast (10), static_cast (nb_displayed_items * 30 + 20), 192, + ARGB(255,240,240,240)); + r->DrawRect(static_cast (x)+1, static_cast (10)+1, static_cast (nb_displayed_items * 30 + 20)-2, 192-2, + ARGB(255,89,89,89)); + + //navi + r->FillRect(static_cast (x), static_cast (y), static_cast (nb_displayed_items * 30 + 20), 50, + ARGB(200,5,5,5)); + r->DrawRect(static_cast (x), static_cast (y), static_cast (nb_displayed_items * 30 + 20), 50, + ARGB(255,240,240,240)); + r->DrawRect(static_cast (x)+1, static_cast (y)+1, static_cast (nb_displayed_items * 30 + 20)-2, 50-2, + ARGB(255,89,89,89)); + } + else + r->DrawRect(static_cast (x), static_cast (y), static_cast (nb_displayed_items * 30 + 20), 50, ARGB(255,255,255,255)); if (!mObjects.size()) return; for (int i = start_item; i < start_item + nb_displayed_items && i < (int)(mObjects.size()); i++) @@ -268,6 +291,10 @@ void CardDisplay::Render() CardGui * cardg = ((CardGui *) mObjects[mCurr]); //Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220); Pos pos = Pos((CardGui::BigWidth / 2), CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220); + + if(norect) + pos = Pos((CardGui::BigWidth / 2), CardGui::BigHeight / 2 - 7, 1.0, 0.0, 220); + int drawMode = DrawMode::kNormal; if (observer) { @@ -276,7 +303,23 @@ void CardDisplay::Render() if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2; drawMode = observer->getCardSelector()->GetDrawMode(); } + if(norect) + { + mFont->SetColor(ARGB(255,240,230,140)); + mFont->SetScale(1.5f); + mFont->DrawString(cardg->card->data->name.c_str(),SCREEN_WIDTH_F/2,20); + mFont->SetColor(ARGB(255,255,255,255)); + mFont->SetScale(1.0f); + string details = ""; + std::vector txt = cardg->card->data->getFormattedText(true); + for (std::vector::const_iterator it = txt.begin(); it != txt.end(); ++it) + { + details.append("\n"); + details.append(it->c_str()); + } + mFont->DrawString(details.c_str(),SCREEN_WIDTH_F/2,25); + } cardg->DrawCard(pos, drawMode); } } diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index fc92feb0a..d4f84d6c7 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -254,11 +254,17 @@ void CardGui::Render() highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white"); if(fakeborder) { - if((card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO))|| - ((card->has(Constants::CANPLAYFROMGRAVEYARD) || card->has(Constants::TEMPFLASHBACK) || card->getManaCost()->getFlashback()) && game->isInGrave(card))) - fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border + if(game) + { + if((card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO))|| + ((card->has(Constants::CANPLAYFROMGRAVEYARD) || card->has(Constants::TEMPFLASHBACK) || card->getManaCost()->getFlashback()) && game->isInGrave(card))) + fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border + else + fakeborder->SetColor(ARGB((int)(actA),15,15,15)); + } else fakeborder->SetColor(ARGB((int)(actA),15,15,15)); + renderer->RenderQuad(fakeborder.get(), actX, actY, actT, (29 * actZ + 1) / 16, 42 * actZ / 16); } //draw border for highlighting @@ -530,18 +536,22 @@ void CardGui::Render() } //for necro - if (!shadow) - shadow = card->getObserver()->getResourceManager()->GetQuad("shadow"); - if (shadow) + if(game) { - int myA = 0; - if(game && card->has(Constants::NECROED))//no peeking... - myA = 255; - else - myA = 0; + if (!shadow) + shadow = card->getObserver()->getResourceManager()->GetQuad("shadow"); + if (shadow) + { + int myA = 0; + if(game && card->has(Constants::NECROED))//no peeking... + myA = 255; + else + myA = 0; - shadow->SetColor(ARGB(myA,255,255,255)); - renderer->RenderQuad(shadow.get(), actX, actY, actT, (28 * actZ + 1) / 16, 40 * actZ / 16); + shadow->SetColor(ARGB(myA,255,255,255)); + if(myA > 0) + renderer->RenderQuad(shadow.get(), actX, actY, actT, (28 * actZ + 1) / 16, 40 * actZ / 16); + } } PlayGuiObject::Render(); diff --git a/projects/mtg/src/CardPrimitive.cpp b/projects/mtg/src/CardPrimitive.cpp index 9a2c7c08c..0db87d2e0 100644 --- a/projects/mtg/src/CardPrimitive.cpp +++ b/projects/mtg/src/CardPrimitive.cpp @@ -298,16 +298,19 @@ void CardPrimitive::setText(const string& value) * Instead, we format when requested, but only once, and cache the result. * To avoid memory to blow up, in exchange of the cached result, we erase the original string */ -const vector& CardPrimitive::getFormattedText() +const vector& CardPrimitive::getFormattedText(bool noremove) { if (!text.size()) return formattedText; std::string::size_type found = text.find_first_of("{}"); - while (found != string::npos) + if(!noremove) { - text[found] = '/'; - found = text.find_first_of("{}", found + 1); + while (found != string::npos) + { + text[found] = '/'; + found = text.find_first_of("{}", found + 1); + } } WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT); mFont->FormatText(text, formattedText); diff --git a/projects/mtg/src/GameStateShop.cpp b/projects/mtg/src/GameStateShop.cpp index b92f3f82e..b75c13f65 100644 --- a/projects/mtg/src/GameStateShop.cpp +++ b/projects/mtg/src/GameStateShop.cpp @@ -308,7 +308,7 @@ void GameStateShop::purchaseBooster(int controlId) SAFE_DELETE(booster); deleteDisplay(); booster = NEW MTGDeck(MTGCollection()); - boosterDisplay = NEW BoosterDisplay(12, NULL, SCREEN_WIDTH - 200, SCREEN_HEIGHT / 2, this, NULL, 5); + boosterDisplay = NEW BoosterDisplay(12, NULL, SCREEN_WIDTH - 255, SCREEN_HEIGHT-65, this, NULL, 7); mBooster[controlId].addToDeck(booster, srcCards); string sort = mBooster[controlId].getSort(); @@ -726,7 +726,7 @@ void GameStateShop::Render() else { if (boosterDisplay) - boosterDisplay->Render(); + boosterDisplay->Render(true); else if (bigDisplay) { if (bigDisplay->mOffset.getPos() >= 0) @@ -743,7 +743,9 @@ void GameStateShop::Render() { alpha = static_cast (800 * (elp - LIST_FADEIN)); } - r->FillRoundRect(300, 10, 160, SHOP_SLOTS * 20 + 15, 5, ARGB(alpha,0,0,0)); + //r->FillRoundRect(300, 10, 160, SHOP_SLOTS * 20 + 15, 5, ARGB(alpha,0,0,0)); + r->FillRect(297, 9.5f, 175, SHOP_SLOTS * 20 + 31, ARGB(alpha,0,0,0)); + r->DrawRect(297, 9.5f, 175, SHOP_SLOTS * 20 + 31, ARGB(alpha,20,20,20)); alpha += 55; for (int i = 0; i < SHOP_SLOTS; i++) { @@ -788,7 +790,7 @@ void GameStateShop::Render() if (menu) menu->Render(); - if (!filterMenu || (filterMenu && filterMenu->isFinished())) + if ((!filterMenu || (filterMenu && filterMenu->isFinished()))&&!boosterDisplay) renderButtons(); }