Skip to content

Commit

Permalink
Loading Screen: removed animation timing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Vultraz committed Aug 10, 2019
1 parent c08cf5c commit e868c7e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
15 changes: 0 additions & 15 deletions src/gui/dialogs/loading_screen.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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_()
Expand Down Expand Up @@ -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*/)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
4 changes: 0 additions & 4 deletions src/gui/dialogs/loading_screen.hpp
Expand Up @@ -99,11 +99,7 @@ class loading_screen : public modal_dialog, public events::pump_monitor
/** 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_;
Expand Down

0 comments on commit e868c7e

Please sign in to comment.