diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-23 23:07:59 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-23 23:07:59 +0200 |
commit | b694b38b407d145fcad37ae10b618310d955d267 (patch) | |
tree | 14e1d4f6191c12b1062978e2678e4bdebf8965f3 /src | |
parent | 2a973ff9402dab9d6c751a146a9f83617d0e5211 (diff) |
Add video loading animation
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 33ebb06..054b3ed 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1640,10 +1640,10 @@ namespace QuickMedia { sf::RectangleShape rect; rect.setFillColor(sf::Color::Red); - // Clear screen before playing video, to show a black screen instead of being frozen - // at the previous UI for a moment - window.clear(); - window.display(); + + sf::Sprite load_sprite(loading_icon); + sf::Vector2u loading_icon_size = loading_icon.getSize(); + load_sprite.setOrigin(loading_icon_size.x * 0.5f, loading_icon_size.y * 0.5f); XEvent xev; bool cursor_visible = true; @@ -1782,7 +1782,14 @@ namespace QuickMedia { break; } - // TODO: Show loading video animation. load_video needs to be made asynchronous first + if(!video_loaded) { + window.clear(back_color); + load_sprite.setPosition(window_size.x * 0.5f - loading_icon_size.x * 0.5f, window_size.y * 0.5f - loading_icon_size.y * 0.5f); + load_sprite.setRotation(-time_watched_timer.getElapsedTime().asSeconds() * 400.0); + window.draw(load_sprite); + window.display(); + continue; + } /* Only save recommendations for the video if we have been watching it for 15 seconds */ if(is_youtube && video_loaded && !added_recommendations && time_watched_timer.getElapsedTime().asSeconds() >= 15) { |