aboutsummaryrefslogtreecommitdiff
path: root/include/RoundedRectangle.hpp
blob: 96e57fdb80d7ce20e60a1f1f68731f485c4fdc41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include <SFML/System/Vector2.hpp>
#include <SFML/Graphics/Vertex.hpp>

namespace sf {
    class RenderTarget;
    class Shader;
}

namespace QuickMedia {
    class RoundedRectangle {
    public:
        RoundedRectangle(sf::Vector2f size, float radius, sf::Color color, sf::Shader *rounded_rectangle_shader);
        void set_position(sf::Vector2f pos);
        void set_size(sf::Vector2f size);
        void set_color(sf::Color color);
        sf::Vector2f get_position() const;
        sf::Vector2f get_size() const;
        void draw(sf::RenderTarget &target);
    private:
        float radius;
        sf::Vector2f pos;
        sf::Vector2f size;
        sf::Vertex vertices[4];
        sf::Shader *rounded_rectangle_shader;
    };
}