JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Rgb.hpp
Go to the documentation of this file.
1// Copyright 2024 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#include <cstdint>
8
9namespace jngl {
10
11class Color;
12
15class Rgb {
16public:
22 Rgb(float red, float green, float blue);
23
24 static Rgb u8(uint8_t red, uint8_t green, uint8_t blue);
25
27 Rgb(Color); // NOLINT
28
30 float getRed() const;
32 void setRed(float);
33
35 float getGreen() const;
37 void setGreen(float);
38
40 float getBlue() const;
42 void setBlue(float);
43
45 explicit operator Color() const;
46
47private:
48 float red;
49 float green;
50 float blue;
51};
52
54Rgb interpolate(Rgb a, Rgb b, float t);
55
56} // namespace jngl
57
59jngl::Rgb operator"" _rgb(unsigned long long);
Object representing a RGB color.
Definition Color.hpp:28
Object representing a RGB color, new version of jngl::Color (which will be deprecated in the future)
Definition Rgb.hpp:15
Rgb(float red, float green, float blue)
void setBlue(float)
0.0f ... 1.0f
float getRed() const
0.0f ... 1.0f
float getGreen() const
0.0f ... 1.0fu
void setRed(float)
0.0f ... 1.0f
void setGreen(float)
0.0f ... 1.0f
Rgb(Color)
Implicit conversion for backwards compatibility.
float getBlue() const
0.0f ... 1.0f
JNGL's main namespace.
Color interpolate(Color a, Color b, float t)
Returns a color mix between a (t == 0) and b (t == 1)