Skip to content

Commit

Permalink
GUI2/Outro: removed next_draw rate limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Oct 6, 2020
1 parent ef31563 commit 8d04afc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
17 changes: 0 additions & 17 deletions src/gui/dialogs/outro.cpp
Expand Up @@ -38,7 +38,6 @@ outro::outro(const game_classification& info)
, fade_step_(0)
, fading_in_(true)
, timer_id_(0)
, next_draw_(0)
{
if(!info.end_text.empty()) {
text_.push_back(info.end_text);
Expand Down Expand Up @@ -95,24 +94,10 @@ void outro::pre_show(window& window)
window.get_canvas(0).set_variable("outro_text", wfl::variant(*current_text_));

connect_signal_on_draw(window, std::bind(&outro::draw_callback, this, std::ref(window)));

set_next_draw();
}

void outro::set_next_draw()
{
/* The UI is rendered at approximately 50 FPS - 1 frame every 20 ms - meaning fading progresses every 3 frames.
* TODO: not sure if 60 is a better value in that case?
*/
next_draw_ = SDL_GetTicks() + 60;
}

void outro::draw_callback(window& window)
{
if(SDL_GetTicks() < next_draw_) {
return;
}

/* If we've faded fully in...
*
* NOTE: we want fading to take around half a second. Given this function runs about every 3 frames, we
Expand Down Expand Up @@ -160,8 +145,6 @@ void outro::draw_callback(window& window)
} else {
fade_step_--;
}

set_next_draw();
}

void outro::post_show(window& /*window*/)
Expand Down
3 changes: 0 additions & 3 deletions src/gui/dialogs/outro.hpp
Expand Up @@ -49,8 +49,6 @@ class outro : public modal_dialog
/** Inherited from modal_dialog. */
virtual void post_show(window& window) override;

void set_next_draw();

void draw_callback(window& window);

std::vector<std::string> text_;
Expand All @@ -62,7 +60,6 @@ class outro : public modal_dialog
bool fading_in_;

std::size_t timer_id_;
std::size_t next_draw_;
};

} // namespace dialogs
Expand Down

0 comments on commit 8d04afc

Please sign in to comment.