Fix audio device problems #1
@@ -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_)
|
||||
|
||||
@@ -34,6 +34,7 @@ private:
|
||||
TextLine play_;
|
||||
TextLine settings_;
|
||||
TextLine bg_;
|
||||
TextLine wifiNote_;
|
||||
|
||||
AppState* state_ = nullptr;
|
||||
float playY_ = 0;
|
||||
|
||||
Reference in New Issue
Block a user