Start game with theme buttons hidden.

Fixes #6922.
This commit is contained in:
Tommy 2023-10-29 04:11:49 +13:00
parent 1c51bd3388
commit 8d4deeef02
2 changed files with 47 additions and 2 deletions

View file

@ -925,6 +925,11 @@ void display::create_buttons()
action_buttons_.push_back(std::move(b));
}
if (prevent_draw_) {
// buttons start hidden in this case
hide_buttons();
}
layout_buttons();
DBG_DP << "buttons created";
}
@ -951,6 +956,26 @@ void display::draw_buttons()
//}
}
void display::hide_buttons()
{
for (auto& button : menu_buttons_) {
button->hide();
}
for (auto& button : action_buttons_) {
button->hide();
}
}
void display::unhide_buttons()
{
for (auto& button : menu_buttons_) {
button->hide(false);
}
for (auto& button : action_buttons_) {
button->hide(false);
}
}
std::vector<texture> display::get_fog_shroud_images(const map_location& loc, image::TYPE image_type)
{
std::vector<std::string> names;
@ -2211,6 +2236,21 @@ double display::turbo_speed() const
return 1.0;
}
void display::set_prevent_draw(bool pd)
{
prevent_draw_ = pd;
if (!pd) {
// ensure buttons are visible
unhide_buttons();
}
}
bool display::get_prevent_draw()
{
return prevent_draw_;
}
void display::fade_tod_mask(
const std::string& old_mask,
const std::string& new_mask)

View file

@ -405,6 +405,11 @@ public:
void draw_buttons();
/** Hide theme buttons so they don't draw. */
void hide_buttons();
/** Unhide theme buttons so they draw again. */
void unhide_buttons();
/** Update the given report. Actual drawing is done in draw_report(). */
void refresh_report(const std::string& report_name, const config * new_cfg=nullptr);
@ -545,8 +550,8 @@ public:
/** Prevent the game display from drawing.
* Used while story screen is showing to prevent flicker. */
void set_prevent_draw(bool pd) { prevent_draw_ = pd; }
bool get_prevent_draw() { return prevent_draw_; }
void set_prevent_draw(bool pd = true);
bool get_prevent_draw();
private:
bool prevent_draw_ = false;