12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /*
- * 2D Physic Engine
- * circle.h:
- * Based on pikuma.com Learn Game Physics Engine Programming course.
- * Copyright (c) 2022 986-Studio. All rights reserved.
- *
- * Created by Manoël Trapier on 18/07/2022.
- */
- #ifndef PHYSICENGINE_SHAPE_CIRCLE_H
- #define PHYSICENGINE_SHAPE_CIRCLE_H
- #include <physics/body.h>
- #include <physics/shape.h>
- #include <graphics.h>
- struct circleShape: public shape
- {
- double radius;
- circleShape() = default;
- circleShape(const double radius) : radius(radius) {};
- virtual ~circleShape() = default;
- shapeType getType() const override
- {
- return SHAPE_CIRCLE;
- }
- double getMomentOfInertial() const override
- {
- return 0.0;
- };
- shape *clone() const override
- {
- return new circleShape(this->radius);
- };
- void draw(const body &bod) override
- {
- graphics::draw::circle(bod.position.x, bod.position.y, this->radius, bod.rotation, bod.colour);
- };
- };
- #endif /* PHYSICENGINE_SHAPE_CIRCLE_H */
|