Loading...
Searching...
No Matches
RoundedRectangle.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
3
4//
5// Created by Dave Smith on 11/9/25.
6//
7
8#ifndef MALENA_ROUNDEDRECTANGLE_H
9#define MALENA_ROUNDEDRECTANGLE_H
10
12#include <SFML/Graphics.hpp>
13#include <cmath>
16
17namespace ml
18{
45 {
46 public:
60 explicit RoundedRectangle(const sf::Vector2f& size = sf::Vector2f(0, 0),
61 float radius = 0.f,
62 unsigned int cornerPointCount = 8);
63
71 void setSize(const sf::Vector2f& size);
72
77 const sf::Vector2f& getSize() const;
78
87 void setRadius(float radius);
88
93 float getRadius() const;
94
102 void setCornerPointCount(unsigned int count);
103
108 unsigned int getCornerPointCount() const;
109
118 virtual std::size_t getPointCount() const override;
119
128 virtual sf::Vector2f getPoint(std::size_t index) const override;
129
130 private:
131 sf::Vector2f m_size;
132 float m_radius;
133 unsigned int m_cornerPointCount;
134 };
135
136} // namespace ml
137
138#endif // MALENA_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.
#define MALENA_API
Definition Component.h:22
Vector2< float > Vector2f