init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
56
Telegram/SourceFiles/ui/effects/ministar_particles.h
Normal file
56
Telegram/SourceFiles/ui/effects/ministar_particles.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/rp_widget.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
class StarParticles final {
|
||||
public:
|
||||
enum class Type {
|
||||
Right,
|
||||
Radial,
|
||||
RadialInside,
|
||||
};
|
||||
|
||||
StarParticles(Type type, int count, int size);
|
||||
|
||||
void setSpeed(float speed);
|
||||
void setVisible(float visible);
|
||||
void setColor(const QColor &color);
|
||||
void paint(QPainter &p, const QRect &rect, crl::time now);
|
||||
|
||||
private:
|
||||
struct Particle {
|
||||
float x = 0.;
|
||||
float y = 0.;
|
||||
float vx = 0.;
|
||||
float vy = 0.;
|
||||
float rotation = 0.;
|
||||
float vrotation = 0.;
|
||||
float size = 0.;
|
||||
float alpha = 0.;
|
||||
crl::time born = 0;
|
||||
};
|
||||
|
||||
void generate();
|
||||
[[nodiscard]] QImage generateStarCache(int size, QColor color);
|
||||
|
||||
Type _type;
|
||||
int _count = 0;
|
||||
int _starSize = 0;
|
||||
float _speed = 1.f;
|
||||
float _visible = 1.f;
|
||||
QColor _color = QColor(255, 200, 70);
|
||||
std::vector<Particle> _particles;
|
||||
base::flat_map<QRgb, QImage> _starCache;
|
||||
crl::time _lastTime = 0;
|
||||
};
|
||||
|
||||
} // namespace Ui
|
||||
Reference in New Issue
Block a user