diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-10-18 01:54:59 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-10-18 01:54:59 +0200 |
commit | 3e081d1669622bbc276b038ddc38ecf0600683c3 (patch) | |
tree | 0a92c34f257c75a2b26e63b0ea9da3d594e89cc8 /src/graphics/Rectangle.cpp |
Initial commit with an example
Diffstat (limited to 'src/graphics/Rectangle.cpp')
-rw-r--r-- | src/graphics/Rectangle.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/graphics/Rectangle.cpp b/src/graphics/Rectangle.cpp new file mode 100644 index 0000000..61a45f4 --- /dev/null +++ b/src/graphics/Rectangle.cpp @@ -0,0 +1,25 @@ +#include "../../include/mglpp/graphics/Rectangle.hpp" + +extern "C" { +#include <mgl/mgl.h> +} + +namespace mgl { + Rectangle::Rectangle(vec2f position, vec2f size) { + rectangle.color = { 1.0f, 1.0f, 1.0f, 1.0f }; + rectangle.position = { position.x, position.y }; + rectangle.size = { size.x, size.y }; + } + + void Rectangle::set_position(vec2f position) { + rectangle.position = { position.x, position.y }; + } + + void Rectangle::set_color(Color color) { + rectangle.color = { color.r, color.g, color.b, color.a }; + } + + void Rectangle::draw(Window&) { + mgl_rectangle_draw(mgl_get_context(), &rectangle); + } +}
\ No newline at end of file |