help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
cpp-shape-drawer
/
include
RSK World
cpp-shape-drawer
C++ Shape Drawer - Advanced Graphics Application + Raylib + OOP Design + Shape Tools + Transformation + Export + Educational Design
include
  • Circle.hpp2 KB
  • DrawingCanvas.hpp7.3 KB
  • PatternGenerator.hpp1.6 KB
  • Polygon.hpp2.3 KB
  • RectangleShape.hpp2.7 KB
  • Shape.hpp4.2 KB
  • Star.hpp2.8 KB
  • TextShape.hpp2 KB
  • Triangle.hpp2.5 KB
Circle.hpp
include/Circle.hpp
Raw Download
Find: Go to:
/**
 * @file Circle.hpp
 * @brief Circle shape implementation.
 * 
 * Part of the C++ Shape Drawer Project.
 * 
 * @author Molla Samser (Founder of RSK World)
 * @designer Rima Khatun
 * @website https://rskworld.in
 * @email hello@rskworld.in
 * @phone +91 93305 39277
 * @location Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147
 * @year 2026
 */

#ifndef CIRCLE_HPP
#define CIRCLE_HPP

#include "Shape.hpp"

class Circle : public Shape {
private:
    float radius;

public:
    Circle(Vector2 pos, float rad, Color col, bool filled = true)
        : Shape(pos, col, filled), radius(rad) {}

    void draw() const override {
        float finalRadius = radius * getEffectiveScale();
        Vector2 pos = getEffectivePosition();
        Color c1 = getEffectiveColor();
        Color c2 = getEffectiveColor(true);

        if (useGradient && isFilled) {
            DrawCircleGradient(pos.x, pos.y, finalRadius, c1, c2);
        } else if (isFilled) {
            DrawCircleV(pos, finalRadius, c1);
        } else {
            DrawCircleLines(pos.x, pos.y, finalRadius, c1);
        }
    }

    bool contains(Vector2 point) const override {
        return CheckCollisionPointCircle(point, position, radius * scale);
    }

    std::string serialize() const override {
        return "CIRCLE," + std::to_string(position.x) + "," + std::to_string(position.y) + "," +
               std::to_string(radius) + "," + std::to_string(color.r) + "," + std::to_string(color.g) + "," +
               std::to_string(color.b) + "," + std::to_string(alpha) + "," + (isFilled ? "1" : "0") + "," +
               std::to_string(rotation) + "," + std::to_string(scale) + "," + (useGradient ? "1" : "0") + "," +
               std::to_string(secondaryColor.r) + "," + std::to_string(secondaryColor.g) + "," +
               std::to_string(secondaryColor.b) + "," + std::to_string((int)animType);
    }

    std::string getType() const override { return "Circle"; }
};

#endif // CIRCLE_HPP
61 lines•2 KB
cpp

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer