#ifndef WIDGET_RECT_H_ #define WIDGET_RECT_H_ #include "Widget.h" // Renders a rectangle with optional rounded corners using either fill or internal stroke class WidgetRect : public Widget { protected: // The color of the rectangle // Default - Black (0, 0, 0) SDL_Color m_color; // Size of the internal stroke // Set to -1 to fill the space // Default - -1 int m_stroke_size; // Corner rounding radius // Default - 0; int m_radius; public: WidgetRect(int x, int y, int width, int height, int radius, int stroke_size, SDL_Color color); WidgetRect(int x, int y, int width, int height, int radius = 0, int stroke_size = -1); void set_color(SDL_Color color); void set_stroke_size(int stroke_size); void set_radius(int radius); virtual void draw() override; static std::unique_ptr builder(const nlohmann::json& j); protected: // x, y - center of circle // quadrant - 1--4 void draw_circle_corner(int x, int y, int quadrant); }; #endif // WIDGET_RECT_H_