Clients can now see download progress of large resources
This commit is contained in:
parent
2a213028c0
commit
3b12f630f8
11 changed files with 87 additions and 30 deletions
|
|
@ -5,6 +5,8 @@
|
|||
#include "../SharedTypes.hpp"
|
||||
#include "../World.hpp"
|
||||
|
||||
#include "../MainProgram.hpp"
|
||||
|
||||
#ifndef IS_SERVER
|
||||
#include <include/core/SkSamplingOptions.h>
|
||||
#include "../DrawCollision.hpp"
|
||||
|
|
@ -54,6 +56,23 @@ void DrawImage::update_from_delayed_ptr(const std::shared_ptr<DrawComponent>& de
|
|||
d = newPtr->d;
|
||||
}
|
||||
|
||||
void DrawImage::draw_download_progress_bar(SkCanvas* canvas, const DrawData& drawData, float progress) {
|
||||
if(progress == 0.0f)
|
||||
return;
|
||||
canvas->save();
|
||||
canvas_do_calculated_transform(canvas);
|
||||
SkPaint p;
|
||||
p.setStroke(true);
|
||||
p.setStrokeWidth(10.0f);
|
||||
p.setStrokeCap(SkPaint::kRound_Cap);
|
||||
p.setColor4f(drawData.main->toolbar.io->theme->fillColor5);
|
||||
Vector2f center = (d.p1 + d.p2) * 0.5f;
|
||||
|
||||
const float DOWNLOAD_ARC_RADIUS = 50.0f;
|
||||
canvas->drawArc(SkRect::MakeLTRB(center.x() - DOWNLOAD_ARC_RADIUS, center.y() - DOWNLOAD_ARC_RADIUS, center.x() + DOWNLOAD_ARC_RADIUS, center.y() + DOWNLOAD_ARC_RADIUS), 0.0f, progress * 360.0f, false, p);
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
void DrawImage::draw(SkCanvas* canvas, const DrawData& drawData) {
|
||||
if(drawSetupData.shouldDraw) {
|
||||
canvas->save();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue