C++ / build (pull_request) Failing after 15s
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 28s
Python / lint-format (pull_request) Successful in 45s
Python / test (pull_request) Successful in 38s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m45s
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <qcolor.h>
|
|
#include <qlist.h>
|
|
#include <qobject.h>
|
|
#include <qqmlengine.h>
|
|
|
|
class BlobShape;
|
|
class BlobInvertedRect;
|
|
|
|
class BlobGroup : public QObject {
|
|
Q_OBJECT
|
|
QML_ELEMENT
|
|
Q_PROPERTY(
|
|
qreal smoothing READ smoothing WRITE setSmoothing NOTIFY
|
|
smoothingChanged)
|
|
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
|
|
|
|
public:
|
|
explicit BlobGroup(QObject* parent = nullptr);
|
|
~BlobGroup() override;
|
|
|
|
[[nodiscard]] qreal smoothing() const { return m_smoothing; }
|
|
|
|
void setSmoothing(qreal s);
|
|
|
|
[[nodiscard]] QColor color() const { return m_color; }
|
|
|
|
void setColor(const QColor& c);
|
|
|
|
void addShape(BlobShape* shape);
|
|
void removeShape(BlobShape* shape);
|
|
|
|
void setInvertedRect(BlobInvertedRect* rect);
|
|
void clearInvertedRect(BlobInvertedRect* rect);
|
|
|
|
[[nodiscard]] const QList<BlobShape*>& shapes() const { return m_shapes; }
|
|
|
|
[[nodiscard]] BlobInvertedRect* invertedRect() const {
|
|
return m_invertedRect;
|
|
}
|
|
|
|
void markDirty();
|
|
void markShapeDirty(BlobShape* source);
|
|
void ensurePhysicsUpdated();
|
|
|
|
signals:
|
|
void smoothingChanged();
|
|
void colorChanged();
|
|
|
|
private:
|
|
qreal m_smoothing = 32.0;
|
|
QColor m_color{0x44, 0x88, 0xff};
|
|
QList<BlobShape*> m_shapes;
|
|
BlobInvertedRect* m_invertedRect = nullptr;
|
|
bool m_physicsUpdated = false;
|
|
};
|