fixed menu
This commit is contained in:
@ -1331,7 +1331,60 @@ void MenuState::render(SDL_Renderer* renderer, float logicalScale, SDL_Rect logi
|
||||
if (imgY < minY) imgY = minY;
|
||||
SDL_FRect dst{ imgX, imgY, targetW, targetH };
|
||||
SDL_SetTextureBlendMode(coopInfoTexture, SDL_BLENDMODE_BLEND);
|
||||
// Make the coop info image slightly transparent
|
||||
SDL_SetTextureAlphaMod(coopInfoTexture, 200);
|
||||
SDL_RenderTexture(renderer, coopInfoTexture, nullptr, &dst);
|
||||
|
||||
// Draw cooperative instructions inside the panel area (overlayed on the panel background)
|
||||
FontAtlas* f = ctx.font ? ctx.font : ctx.pixelFont;
|
||||
if (f) {
|
||||
const float pad = 38.0f;
|
||||
float textX = panelBaseX + pad;
|
||||
// Position the text over the lower portion of the image (overlay)
|
||||
// Move the block upward by ~150px to match UI request
|
||||
float textY = imgY + targetH - std::min(80.0f, targetH * 0.35f) - 150.0f;
|
||||
|
||||
// Bulleted list (measure sample line height first)
|
||||
const std::vector<std::string> bullets = {
|
||||
"The playfield is shared between two players",
|
||||
"Each player controls one half of the grid",
|
||||
"A line clears only when both halves are filled",
|
||||
"Timing and coordination are essential"
|
||||
};
|
||||
float bulletScale = 0.78f;
|
||||
SDL_Color bulletCol{200,220,230,220};
|
||||
int sampleLW = 0, sampleLH = 0;
|
||||
f->measure(bullets[0], bulletScale, sampleLW, sampleLH);
|
||||
|
||||
// Header: move it up by one sample row so it sits higher
|
||||
const std::string header = "* HOW TO PLAY – COOPERATE MODE *";
|
||||
float headerScale = 0.95f;
|
||||
int hW=0, hH=0; f->measure(header, headerScale, hW, hH);
|
||||
float hx = panelBaseX + (panelW - static_cast<float>(hW)) * 0.5f + 40.0f; // nudge header right by 40px
|
||||
float headerY = textY - static_cast<float>(sampleLH);
|
||||
f->draw(renderer, hx, headerY, header, headerScale, SDL_Color{220,240,255,230});
|
||||
// Start body text slightly below header
|
||||
textY = headerY + static_cast<float>(hH) + 8.0f;
|
||||
|
||||
// Shift non-header text to the right by 100px and down by 20px
|
||||
float bulletX = textX + 200.0f;
|
||||
textY += 20.0f;
|
||||
for (const auto &line : bullets) {
|
||||
std::string withBullet = std::string("• ") + line;
|
||||
f->draw(renderer, bulletX, textY, withBullet, bulletScale, bulletCol);
|
||||
int lw=0, lH=0; f->measure(withBullet, bulletScale, lw, lH);
|
||||
textY += static_cast<float>(lH) + 6.0f;
|
||||
}
|
||||
|
||||
// GOAL section (aligned with shifted bullets)
|
||||
textY += 6.0f;
|
||||
std::string goalTitle = "GOAL:";
|
||||
f->draw(renderer, bulletX, textY, goalTitle, 0.88f, SDL_Color{255,215,80,230});
|
||||
int gW=0, gH=0; f->measure(goalTitle, 0.88f, gW, gH);
|
||||
float goalX = bulletX + static_cast<float>(gW) + 10.0f;
|
||||
std::string goalText = "Clear lines together and achieve the highest TEAM SCORE";
|
||||
f->draw(renderer, goalX, textY, goalText, 0.86f, SDL_Color{220,240,255,220});
|
||||
}
|
||||
}
|
||||
|
||||
UIRenderer::drawButton(renderer, ctx.pixelFont, coopSetupBtnRects[0].x + btnW2 * 0.5f, coopSetupBtnRects[0].y + btnH2 * 0.5f,
|
||||
|
||||
Reference in New Issue
Block a user