Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
has_color.h
1#ifndef OE_GUI_COMPONENT_UTIL_HAS_COLOR_H
2#define OE_GUI_COMPONENT_UTIL_HAS_COLOR_H
3
4#include <string>
5#include <glm/vec4.hpp>
6
7namespace oe::gui::component
8{
9 class HasColor
10 {
11 public:
12 void setColor255(const uint8_t& r, const uint8_t& g, const uint8_t& b, const uint8_t& a = 255)
13 {
14 _color[0] = r;
15 _color[1] = g;
16 _color[2] = b;
17 _color[3] = a;
18
19 _is_colored = true;
20 }
21
22 void setColor(const glm::vec4& color)
23 {
24 _color[0] = color.r * 255;
25 _color[1] = color.g * 255;
26 _color[2] = color.b * 255;
27 _color[3] = color.a * 255;
28
29 _is_colored = true;
30 }
31
32 void resetColor()
33 {
34 _color[0] = 255;
35 _color[1] = 255;
36 _color[2] = 255;
37 _color[3] = 255;
38
39 _is_colored = false;
40 }
41
42 protected:
43 bool _is_colored = false;
44 uint8_t _color[4];
45 };
46}
47#endif
Definition has_color.h:10
UI components.
Definition component.h:15