visual makeover of backgrounds for each level
BIN
assets/images/levels/level0.jpg
Normal file
|
After Width: | Height: | Size: 257 KiB |
BIN
assets/images/levels/level1.jpg
Normal file
|
After Width: | Height: | Size: 226 KiB |
BIN
assets/images/levels/level10.jpg
Normal file
|
After Width: | Height: | Size: 188 KiB |
BIN
assets/images/levels/level11.jpg
Normal file
|
After Width: | Height: | Size: 204 KiB |
BIN
assets/images/levels/level12.jpg
Normal file
|
After Width: | Height: | Size: 157 KiB |
BIN
assets/images/levels/level13.jpg
Normal file
|
After Width: | Height: | Size: 333 KiB |
BIN
assets/images/levels/level14.jpg
Normal file
|
After Width: | Height: | Size: 265 KiB |
BIN
assets/images/levels/level15.jpg
Normal file
|
After Width: | Height: | Size: 298 KiB |
BIN
assets/images/levels/level16.jpg
Normal file
|
After Width: | Height: | Size: 144 KiB |
BIN
assets/images/levels/level17.jpg
Normal file
|
After Width: | Height: | Size: 276 KiB |
BIN
assets/images/levels/level18.jpg
Normal file
|
After Width: | Height: | Size: 223 KiB |
BIN
assets/images/levels/level19.jpg
Normal file
|
After Width: | Height: | Size: 281 KiB |
BIN
assets/images/levels/level2.jpg
Normal file
|
After Width: | Height: | Size: 450 KiB |
BIN
assets/images/levels/level20.jpg
Normal file
|
After Width: | Height: | Size: 315 KiB |
BIN
assets/images/levels/level21.jpg
Normal file
|
After Width: | Height: | Size: 322 KiB |
BIN
assets/images/levels/level22.jpg
Normal file
|
After Width: | Height: | Size: 323 KiB |
BIN
assets/images/levels/level23.jpg
Normal file
|
After Width: | Height: | Size: 242 KiB |
BIN
assets/images/levels/level24.jpg
Normal file
|
After Width: | Height: | Size: 349 KiB |
BIN
assets/images/levels/level25.jpg
Normal file
|
After Width: | Height: | Size: 387 KiB |
BIN
assets/images/levels/level26.jpg
Normal file
|
After Width: | Height: | Size: 226 KiB |
BIN
assets/images/levels/level27.jpg
Normal file
|
After Width: | Height: | Size: 203 KiB |
BIN
assets/images/levels/level28.jpg
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
assets/images/levels/level29.jpg
Normal file
|
After Width: | Height: | Size: 297 KiB |
BIN
assets/images/levels/level3.jpg
Normal file
|
After Width: | Height: | Size: 328 KiB |
BIN
assets/images/levels/level30.jpg
Normal file
|
After Width: | Height: | Size: 245 KiB |
BIN
assets/images/levels/level31.jpg
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
assets/images/levels/level32.jpg
Normal file
|
After Width: | Height: | Size: 295 KiB |
BIN
assets/images/levels/level4.jpg
Normal file
|
After Width: | Height: | Size: 145 KiB |
BIN
assets/images/levels/level5.jpg
Normal file
|
After Width: | Height: | Size: 199 KiB |
BIN
assets/images/levels/level6.jpg
Normal file
|
After Width: | Height: | Size: 142 KiB |
BIN
assets/images/levels/level7.jpg
Normal file
|
After Width: | Height: | Size: 117 KiB |
BIN
assets/images/levels/level8.jpg
Normal file
|
After Width: | Height: | Size: 335 KiB |
BIN
assets/images/levels/level9.jpg
Normal file
|
After Width: | Height: | Size: 420 KiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 756 KiB |
|
Before Width: | Height: | Size: 1007 KiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 957 KiB |
|
Before Width: | Height: | Size: 805 KiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 947 KiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 825 KiB |
|
Before Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 970 KiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 1007 KiB |
|
Before Width: | Height: | Size: 638 KiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 828 KiB |
|
Before Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1010 KiB |
|
Before Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 995 KiB |
@ -160,7 +160,7 @@ static bool queueLevelBackground(LevelBackgroundFader& fader, SDL_Renderer* rend
|
|||||||
}
|
}
|
||||||
|
|
||||||
char bgPath[256];
|
char bgPath[256];
|
||||||
std::snprintf(bgPath, sizeof(bgPath), "assets/images/tetris_main_back_level%d.jpg", level);
|
std::snprintf(bgPath, sizeof(bgPath), "assets/images/levels/level%d.jpg", level);
|
||||||
|
|
||||||
SDL_Texture* newTexture = loadTextureFromImage(renderer, bgPath);
|
SDL_Texture* newTexture = loadTextureFromImage(renderer, bgPath);
|
||||||
if (!newTexture) {
|
if (!newTexture) {
|
||||||
|
|||||||
@ -120,7 +120,7 @@ void MenuState::renderMainButtonTop(SDL_Renderer* renderer, float logicalScale,
|
|||||||
const float LOGICAL_W = 1200.f;
|
const float LOGICAL_W = 1200.f;
|
||||||
const float LOGICAL_H = 1000.f;
|
const float LOGICAL_H = 1000.f;
|
||||||
float contentOffsetX = 0.0f;
|
float contentOffsetX = 0.0f;
|
||||||
float contentOffsetY = 20.0f;
|
float contentOffsetY = 0.0f;
|
||||||
UIRenderer::computeContentOffsets((float)logicalVP.w, (float)logicalVP.h, LOGICAL_W, LOGICAL_H, logicalScale, contentOffsetX, contentOffsetY);
|
UIRenderer::computeContentOffsets((float)logicalVP.w, (float)logicalVP.h, LOGICAL_W, LOGICAL_H, logicalScale, contentOffsetX, contentOffsetY);
|
||||||
|
|
||||||
float contentW = LOGICAL_W * logicalScale;
|
float contentW = LOGICAL_W * logicalScale;
|
||||||
@ -131,7 +131,7 @@ void MenuState::renderMainButtonTop(SDL_Renderer* renderer, float logicalScale,
|
|||||||
// move buttons a bit lower for better visibility
|
// move buttons a bit lower for better visibility
|
||||||
// small global vertical offset for the whole menu (tweak to move UI down)
|
// small global vertical offset for the whole menu (tweak to move UI down)
|
||||||
float menuYOffset = LOGICAL_H * 0.03f;
|
float menuYOffset = LOGICAL_H * 0.03f;
|
||||||
float btnY = LOGICAL_H * 0.865f + contentOffsetY + (LOGICAL_H * 0.02f) + menuYOffset + 45.0f;
|
float btnY = LOGICAL_H * 0.865f + contentOffsetY + (LOGICAL_H * 0.02f) + menuYOffset + 4.5f;
|
||||||
|
|
||||||
// Compose same button definition used in render()
|
// Compose same button definition used in render()
|
||||||
char levelBtnText[32];
|
char levelBtnText[32];
|
||||||
@ -153,6 +153,8 @@ void MenuState::renderMainButtonTop(SDL_Renderer* renderer, float logicalScale,
|
|||||||
|
|
||||||
|
|
||||||
// Draw semi-transparent background panel behind the full button group (draw first so text sits on top)
|
// Draw semi-transparent background panel behind the full button group (draw first so text sits on top)
|
||||||
|
// `groupCenterY` is declared here so it can be used when drawing the buttons below.
|
||||||
|
float groupCenterY = 0.0f;
|
||||||
{
|
{
|
||||||
float groupCenterX = btnX;
|
float groupCenterX = btnX;
|
||||||
float halfSpan = 1.5f * spacing; // covers from leftmost to rightmost button centers
|
float halfSpan = 1.5f * spacing; // covers from leftmost to rightmost button centers
|
||||||
@ -179,12 +181,15 @@ void MenuState::renderMainButtonTop(SDL_Renderer* renderer, float logicalScale,
|
|||||||
// Expand border to cover full window width (use actual viewport)
|
// Expand border to cover full window width (use actual viewport)
|
||||||
SDL_FRect borderFull{ 0.0f, panelTop, viewportLogicalW, panelH };
|
SDL_FRect borderFull{ 0.0f, panelTop, viewportLogicalW, panelH };
|
||||||
SDL_RenderRect(renderer, &borderFull);
|
SDL_RenderRect(renderer, &borderFull);
|
||||||
|
// Compute a vertical center for the group so labels/icons can be centered
|
||||||
|
groupCenterY = panelTop + panelH * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw all four buttons on top
|
// Draw all four buttons on top
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
float cxCenter = 0.0f;
|
float cxCenter = 0.0f;
|
||||||
float cyCenter = btnY;
|
// Use the group's center Y so text/icons sit visually centered in the panel
|
||||||
|
float cyCenter = groupCenterY;
|
||||||
if (ctx.menuButtonsExplicit) {
|
if (ctx.menuButtonsExplicit) {
|
||||||
cxCenter = ctx.menuButtonCX[i] + contentOffsetX;
|
cxCenter = ctx.menuButtonCX[i] + contentOffsetX;
|
||||||
cyCenter = ctx.menuButtonCY[i] + contentOffsetY;
|
cyCenter = ctx.menuButtonCY[i] + contentOffsetY;
|
||||||
@ -302,8 +307,8 @@ void MenuState::handleEvent(const SDL_Event& e) {
|
|||||||
|
|
||||||
// If the inline options HUD is visible and not animating, capture navigation
|
// If the inline options HUD is visible and not animating, capture navigation
|
||||||
if (optionsVisible && !optionsAnimating) {
|
if (optionsVisible && !optionsAnimating) {
|
||||||
// Options now has more rows; use OPTIONS_ROW_COUNT
|
// Options rows drawn here are 5 (Fullscreen, Music, Sound FX, Smooth Scroll, Return)
|
||||||
constexpr int OPTIONS_ROW_COUNT = 8;
|
constexpr int OPTIONS_ROW_COUNT = 5;
|
||||||
switch (e.key.scancode) {
|
switch (e.key.scancode) {
|
||||||
case SDL_SCANCODE_UP:
|
case SDL_SCANCODE_UP:
|
||||||
{
|
{
|
||||||
@ -356,25 +361,6 @@ void MenuState::handleEvent(const SDL_Event& e) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
// PULSE ENABLE
|
|
||||||
buttonPulseEnabled = !buttonPulseEnabled;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case 5: {
|
|
||||||
// PULSE SPEED (Enter toggles to default)
|
|
||||||
if (e.key.scancode == SDL_SCANCODE_RETURN || e.key.scancode == SDL_SCANCODE_KP_ENTER || e.key.scancode == SDL_SCANCODE_SPACE) {
|
|
||||||
buttonPulseSpeed = 1.0;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case 6: {
|
|
||||||
// PULSE MIN ALPHA (Enter resets)
|
|
||||||
if (e.key.scancode == SDL_SCANCODE_RETURN || e.key.scancode == SDL_SCANCODE_KP_ENTER || e.key.scancode == SDL_SCANCODE_SPACE) {
|
|
||||||
buttonPulseMinAlpha = 0.6;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case 7: {
|
|
||||||
// RETURN TO MENU -> hide panel
|
// RETURN TO MENU -> hide panel
|
||||||
optionsAnimating = true;
|
optionsAnimating = true;
|
||||||
optionsDirection = -1;
|
optionsDirection = -1;
|
||||||
|
|||||||