GUI2/Outro: don't keep unnecessary copy of current text
This commit is contained in:
parent
1371bc8cb7
commit
82fa0742a1
2 changed files with 7 additions and 7 deletions
|
@ -43,7 +43,6 @@ REGISTER_DIALOG(outro)
|
|||
outro::outro(const game_classification& info)
|
||||
: modal_dialog(window_id())
|
||||
, text_()
|
||||
, current_text_()
|
||||
, text_index_(0)
|
||||
, duration_(info.end_text_duration)
|
||||
, fade_alpha_(0)
|
||||
|
@ -94,8 +93,6 @@ outro::outro(const game_classification& info)
|
|||
}
|
||||
}
|
||||
|
||||
current_text_ = text_[0];
|
||||
|
||||
if(!duration_) {
|
||||
duration_ = 3500; // 3.5 seconds
|
||||
}
|
||||
|
@ -104,7 +101,7 @@ outro::outro(const game_classification& info)
|
|||
void outro::pre_show(window& window)
|
||||
{
|
||||
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()
|
||||
|
@ -141,10 +138,9 @@ void outro::update()
|
|||
window::close();
|
||||
return;
|
||||
}
|
||||
current_text_ = text_[text_index_];
|
||||
|
||||
// ...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;
|
||||
|
||||
|
|
|
@ -48,8 +48,12 @@ private:
|
|||
|
||||
virtual void post_show(window& window) override;
|
||||
|
||||
const std::string& current_text() const
|
||||
{
|
||||
return text_[text_index_];
|
||||
}
|
||||
|
||||
std::vector<std::string> text_;
|
||||
std::string current_text_;
|
||||
std::size_t text_index_;
|
||||
|
||||
unsigned int duration_;
|
||||
|
|
Loading…
Add table
Reference in a new issue