From 3e081d1669622bbc276b038ddc38ecf0600683c3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 18 Oct 2021 01:54:59 +0200 Subject: Initial commit with an example --- src/graphics/Rectangle.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/graphics/Rectangle.cpp (limited to 'src/graphics/Rectangle.cpp') 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 +} + +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 -- cgit v1.2.3