aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------depends/mgl0
-rw-r--r--include/mglpp/graphics/Color.hpp11
-rw-r--r--src/graphics/Rectangle.cpp2
-rw-r--r--tests/main.cpp4
4 files changed, 10 insertions, 7 deletions
diff --git a/depends/mgl b/depends/mgl
-Subproject 4a96d4a354fbde7fd614075c060aea78a3411b4
+Subproject 3bdf82eec2c915e91ae487e29d72639f9efcad6
diff --git a/include/mglpp/graphics/Color.hpp b/include/mglpp/graphics/Color.hpp
index d1c1745..0d0ac15 100644
--- a/include/mglpp/graphics/Color.hpp
+++ b/include/mglpp/graphics/Color.hpp
@@ -1,12 +1,15 @@
#ifndef MGLPP_COLOR_HPP
#define MGLPP_COLOR_HPP
+#include <stdint.h>
+
namespace mgl {
struct Color {
- float r = 1.0f;
- float g = 1.0f;
- float b = 1.0f;
- float a = 1.0f;
+ Color(uint8_t r = 255, uint8_t g = 255, uint8_t b = 255, uint8_t a = 255) : r(r), g(g), b(b), a(a) {
+
+ }
+
+ uint8_t r, g, b, a;
};
}
diff --git a/src/graphics/Rectangle.cpp b/src/graphics/Rectangle.cpp
index 61a45f4..17060c7 100644
--- a/src/graphics/Rectangle.cpp
+++ b/src/graphics/Rectangle.cpp
@@ -6,7 +6,7 @@ extern "C" {
namespace mgl {
Rectangle::Rectangle(vec2f position, vec2f size) {
- rectangle.color = { 1.0f, 1.0f, 1.0f, 1.0f };
+ rectangle.color = { 255, 255, 255, 255 };
rectangle.position = { position.x, position.y };
rectangle.size = { size.x, size.y };
}
diff --git a/tests/main.cpp b/tests/main.cpp
index bddfc3f..3595717 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -12,11 +12,11 @@ struct Delegate : public mgl::Window::Delegate {
void draw() override {
mgl::Rectangle rect(window->get_cursor_position().to_vec2f(), { 100.0f, 500.0f });
- rect.set_color({1.0f, 0.0f, 0.0f, 1.0f});
+ rect.set_color({255, 0, 0, 255});
window->draw(rect);
mgl::Sprite sprite(*texture, { 100.0f - 10.0f, 0.0f });
- sprite.set_color({1.0f, 1.0f, 1.0f, 0.5f});
+ sprite.set_color({255, 255, 255, 128});
window->draw(sprite);
mgl::Text text("hello world!\nGood bye world!", { 0.0f, 0.0f }, *font);