Represents a 2D shape made up of vertices that can be rendered to the screen. More...
#include <shape.hpp>
Public Member Functions | |
Shape (const std::vector< float > &vertices) | |
Construct a new Shape object with the given vertices. | |
void | draw () |
Renders the shape to the screen. | |
~Shape () | |
Destroy the Shape object and release OpenGL resources. | |
Public Attributes | |
Transform2D | tr |
The 2D transformation applied to the shape. | |
Represents a 2D shape made up of vertices that can be rendered to the screen.
This class is responsible for handling the vertex data of the shape, setting up the OpenGL buffers (VAO and VBO), and providing a function to render the shape to the screen. It also includes a Transform2D
member, which can be used to apply transformations (e.g., translation, scaling, and rotation) to the shape.
Raftel::Shape::Shape | ( | const std::vector< float > & | vertices | ) |
Construct a new Shape object with the given vertices.
Initializes the shape with the provided vertex data and sets up the necessary OpenGL buffers (VAO, VBO) for rendering.
vertices | A vector of floats representing the vertex data of the shape. |
Raftel::Shape::~Shape | ( | ) |
void Raftel::Shape::draw | ( | ) |
Renders the shape to the screen.
This function binds the shape's VAO and draws the shape to the screen using the stored vertex data. It also applies the transformation before drawing and resets it afterward.
Transform2D Raftel::Shape::tr |