Loading...
Searching...
No Matches
RoundedRectangle.h
Go to the documentation of this file.
1//
2// Created by Dave Smith on 11/9/25.
3//
4
5#ifndef ROUNDEDRECTANGLE_H
6#define ROUNDEDRECTANGLE_H
7
8#include <SFML/Graphics.hpp>
9#include <cmath>
12
13namespace ml
14{
41 {
42 public:
56 explicit RoundedRectangle(const sf::Vector2f& size = sf::Vector2f(0, 0),
57 float radius = 0.f,
58 unsigned int cornerPointCount = 8);
59
67 void setSize(const sf::Vector2f& size);
68
73 const sf::Vector2f& getSize() const;
74
83 void setRadius(float radius);
84
89 float getRadius() const;
90
98 void setCornerPointCount(unsigned int count);
99
104 unsigned int getCornerPointCount() const;
105
114 virtual std::size_t getPointCount() const override;
115
124 virtual sf::Vector2f getPoint(std::size_t index) const override;
125
126 private:
127 sf::Vector2f m_size;
128 float m_radius;
129 unsigned int m_cornerPointCount;
130 };
131
132} // namespace ml
133
134#endif // ROUNDEDRECTANGLE_H
const sf::Vector2f & getSize() const
Return the current size of the rectangle.
void setSize(const sf::Vector2f &size)
Set the width and height of the rectangle.
virtual sf::Vector2f getPoint(std::size_t index) const override
Return the position of a single vertex.
float getRadius() const
Return the current corner arc radius.
RoundedRectangle(const sf::Vector2f &size=sf::Vector2f(0, 0), float radius=0.f, unsigned int cornerPointCount=8)
Construct a rounded rectangle.
void setRadius(float radius)
Set the corner arc radius.
unsigned int getCornerPointCount() const
Return the current per-corner vertex count.
virtual std::size_t getPointCount() const override
Return the total number of shape vertices.
void setCornerPointCount(unsigned int count)
Set the number of vertices per corner arc.
Definition Component.h:18
Vector2< float > Vector2f