Loading Screen: removed animation timing

Decided it's better to just tie this to the draw rate. There were problems with the timing on the accelerated_rendering
branch, so I had disabled it there, but I think it's better without the timing so I'll just leave this.
This commit is contained in:
Charles Dang 2019-08-11 07:24:17 +11:00
parent c08cf5c01a
commit e868c7e890
2 changed files with 0 additions and 19 deletions

View file

@ -34,7 +34,6 @@
#include <chrono>
#include <cstdlib>
#include <limits>
static lg::log_domain log_loadscreen("loadscreen");
#define ERR_LS LOG_STREAM(err, log_loadscreen)
@ -76,7 +75,6 @@ loading_screen* loading_screen::current_load = nullptr;
loading_screen::loading_screen(std::function<void()> f)
: animation_counter_(0)
, next_animation_time_(std::numeric_limits<uint32_t>::max())
, load_func_(f)
, worker_result_()
, cursor_setter_()
@ -133,8 +131,6 @@ void loading_screen::pre_show(window& window)
// Add a draw callback to handle the animation, et al.
window.connect_signal<event::DRAW>(
std::bind(&loading_screen::draw_callback, this), event::dispatcher::front_child);
set_next_animation_time();
}
void loading_screen::post_show(window& /*window*/)
@ -175,16 +171,10 @@ void loading_screen::draw_callback()
progress_stage_label_->set_label(iter->second);
}
//if(SDL_GetTicks() < next_animation_time_) {
// return;
//}
++animation_counter_;
if(animation_counter_ % 2 == 0) {
animation_label_->set_label(animation_stages_[(animation_counter_ / 2) % animation_stages_.size()]);
}
//set_next_animation_time();
}
loading_screen::~loading_screen()
@ -230,10 +220,5 @@ bool loading_screen::loading_complete() const
return worker_result_.wait_for(0ms) == std::future_status::ready;
}
void loading_screen::set_next_animation_time()
{
next_animation_time_ = SDL_GetTicks() + 100;
}
} // namespace dialogs
} // namespace gui2

View file

@ -99,11 +99,7 @@ private:
/** Callback to handle drawing the progress animation. */
void draw_callback();
void set_next_animation_time();
int animation_counter_;
uint32_t next_animation_time_;
std::function<void()> load_func_;
std::future<void> worker_result_;
std::unique_ptr<cursor::setter> cursor_setter_;