mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-14 21:19:08 +00:00
GUI2/Outro: don't keep unnecessary copy of current text
This commit is contained in:
parent
1371bc8cb7
commit
82fa0742a1
@ -43,7 +43,6 @@ REGISTER_DIALOG(outro)
|
|||||||
outro::outro(const game_classification& info)
|
outro::outro(const game_classification& info)
|
||||||
: modal_dialog(window_id())
|
: modal_dialog(window_id())
|
||||||
, text_()
|
, text_()
|
||||||
, current_text_()
|
|
||||||
, text_index_(0)
|
, text_index_(0)
|
||||||
, duration_(info.end_text_duration)
|
, duration_(info.end_text_duration)
|
||||||
, fade_alpha_(0)
|
, fade_alpha_(0)
|
||||||
@ -94,8 +93,6 @@ outro::outro(const game_classification& info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
current_text_ = text_[0];
|
|
||||||
|
|
||||||
if(!duration_) {
|
if(!duration_) {
|
||||||
duration_ = 3500; // 3.5 seconds
|
duration_ = 3500; // 3.5 seconds
|
||||||
}
|
}
|
||||||
@ -104,7 +101,7 @@ outro::outro(const game_classification& info)
|
|||||||
void outro::pre_show(window& window)
|
void outro::pre_show(window& window)
|
||||||
{
|
{
|
||||||
window.set_enter_disabled(true);
|
window.set_enter_disabled(true);
|
||||||
window.get_canvas(0).set_variable("outro_text", wfl::variant(current_text_));
|
window.get_canvas(0).set_variable("outro_text", wfl::variant{current_text()});
|
||||||
}
|
}
|
||||||
|
|
||||||
void outro::update()
|
void outro::update()
|
||||||
@ -141,10 +138,9 @@ void outro::update()
|
|||||||
window::close();
|
window::close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
current_text_ = text_[text_index_];
|
|
||||||
|
|
||||||
// ...else show the next bit.
|
// ...else show the next bit.
|
||||||
window_canvas.set_variable("outro_text", wfl::variant(current_text_));
|
window_canvas.set_variable("outro_text", wfl::variant{current_text()});
|
||||||
|
|
||||||
fading_in_ = true;
|
fading_in_ = true;
|
||||||
|
|
||||||
|
@ -48,8 +48,12 @@ private:
|
|||||||
|
|
||||||
virtual void post_show(window& window) override;
|
virtual void post_show(window& window) override;
|
||||||
|
|
||||||
|
const std::string& current_text() const
|
||||||
|
{
|
||||||
|
return text_[text_index_];
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> text_;
|
std::vector<std::string> text_;
|
||||||
std::string current_text_;
|
|
||||||
std::size_t text_index_;
|
std::size_t text_index_;
|
||||||
|
|
||||||
unsigned int duration_;
|
unsigned int duration_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user