diff options
author | Samuel Fadel <samuel@nihil.ws> | 2023-05-23 11:22:33 +0200 |
---|---|---|
committer | Samuel Fadel <samuel@nihil.ws> | 2023-05-23 11:22:33 +0200 |
commit | 0f34fd437efb936ef29ac91186321aa7251fbfb1 (patch) | |
tree | 271e994828f4bb19c35b2630f2705cb64b8d4552 /geometry.h | |
parent | bedf6936885694688ddb8bd3452f6bd68ef8d29c (diff) |
Massive changes in initial port away from Qt.
Diffstat (limited to 'geometry.h')
-rw-r--r-- | geometry.h | 49 |
1 files changed, 45 insertions, 4 deletions
@@ -1,17 +1,58 @@ #ifndef GEOMETRY_H #define GEOMETRY_H -#include <QSGGeometry> +class Point2D +{ +public: + Point2D(); + + void set(float, float); + float x() const { return m_x; } + float y() const { return m_y; } + +private: + float m_x, m_y; +}; + +class RectF +{ +public: + RectF(float, float, float, float); + RectF(const RectF &); + RectF(const Point2D &, const Point2D &); + + float x() const { return m_x; } + float y() const { return m_y; } + float width() const { return m_width; } + float height() const { return m_height; } + + bool contains(float x, float y) const; + bool intersects(const RectF &) const; + +private: + float m_x, m_y, m_width, m_height; +}; + +class Geometry +{ +public: + Geometry(); + + int vertexCount() const; + Point2D *vertexDataAsPoint2D(); + +private: +}; // Circle int calculateCircleVertexCount(float radius); -void updateCircleGeometry(QSGGeometry *geometry, float radius, float cx, float cy); +void updateCircleGeometry(Geometry *geometry, float radius, float cx, float cy); // Rect -void updateRectGeometry(QSGGeometry *geometry, float x, float y, float w, float h); +void updateRectGeometry(Geometry *geometry, float x, float y, float w, float h); // Crosshair -void updateCrossHairGeometry(QSGGeometry *geometry, +void updateCrossHairGeometry(Geometry *geometry, float x, float y, float thickness, |