Files
tdesktop/Telegram/SourceFiles/ui/effects/ministar_particles.h
allhaileris afb81b8278
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
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
init
2026-02-16 15:50:16 +03:00

57 lines
1.1 KiB
C++

/*
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