From d60a8bd7fb96086eedb4e8e15498a28be4f4efac Mon Sep 17 00:00:00 2001 From: NeilClack Date: Fri, 28 Aug 2026 15:35:57 -0500 Subject: [PATCH] Add WiFi prompt --- src/home.cpp | 24 ++++++++++++++++++++++++ src/home.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/home.cpp b/src/home.cpp index cc7eb77..ad9e384 100644 --- a/src/home.cpp +++ b/src/home.cpp @@ -180,6 +180,16 @@ void Home::render(SDL_Renderer *renderer) SDL_RenderFillRect(renderer, &line); } + // Large bold reminder to connect WiFi, drawn below the menu while no + // network is joined (refreshed every 5s in update()). + if (wifiNote_.texture && ssid_.empty()) + { + float noteX = (fw - wifiNote_.width) / 2.0f; + float noteY = settingsY_ + settings_.height + 40.0f; + SDL_FRect noteDst{noteX, noteY, wifiNote_.width, wifiNote_.height}; + SDL_RenderTexture(renderer, wifiNote_.texture, nullptr, ¬eDst); + } + // Bottom-right status footer (20pt, aligned to a virtual rectangle: // names left-aligned at the rect's left edge, values right-aligned at // the rect's right edge; the longest name's colon sits 4 spaces from its @@ -352,6 +362,15 @@ void Home::createTextures(AppState &state) TTF_CloseFont(font); + font = TTF_OpenFont("assets/fonts/Roboto-Regular.ttf", 48); + if (font) + { + TTF_SetFontStyle(font, TTF_STYLE_BOLD); + wifiNote_ = renderText(state.renderer, font, "Please connect to WiFi", white); + TTF_SetFontStyle(font, TTF_STYLE_NORMAL); + TTF_CloseFont(font); + } + SDL_Surface *bgSurface = IMG_Load("assets/images/RWT-Circular-Color-ForOnDark-NoText.png"); if (bgSurface) { @@ -410,6 +429,11 @@ void Home::destroyTextures() SDL_DestroyTexture(settings_.texture); settings_.texture = nullptr; } + if (wifiNote_.texture) + { + SDL_DestroyTexture(wifiNote_.texture); + wifiNote_.texture = nullptr; + } for (auto &t : footerNames_) t.destroy(); for (auto &t : footerValues_) diff --git a/src/home.h b/src/home.h index 40d04ce..c56db1b 100644 --- a/src/home.h +++ b/src/home.h @@ -34,6 +34,7 @@ private: TextLine play_; TextLine settings_; TextLine bg_; + TextLine wifiNote_; AppState* state_ = nullptr; float playY_ = 0;