JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Color.hpp
Go to the documentation of this file.
1// Copyright 2012-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 "Rgb.hpp"
8
9namespace jngl {
10
28class Color {
29public:
33 Color(unsigned char red, unsigned char green, unsigned char blue);
34
36 unsigned char getRed() const;
38 void setRed(unsigned char);
39
41 unsigned char getGreen() const;
43 void setGreen(unsigned char);
44
46 unsigned char getBlue() const;
48 void setBlue(unsigned char);
49
51 operator Rgb() const; // NOLINT
52
53private:
54 unsigned char red;
55 unsigned char green;
56 unsigned char blue;
57};
58
61
64
67[[deprecated("use setBackgroundColor(jngl::Rgb) instead")]]
68void setBackgroundColor(unsigned char red, unsigned char green, unsigned char blue);
69
70} // namespace jngl
71
73jngl::Color operator"" _rgb(unsigned long long);
Contains jngl::Rgb class.
Object representing a RGB color.
Definition Color.hpp:28
Color(unsigned char red, unsigned char green, unsigned char blue)
unsigned char getBlue() const
0...255
void setBlue(unsigned char)
0...255
void setGreen(unsigned char)
0...255
void setRed(unsigned char)
0...255
unsigned char getRed() const
0...255
unsigned char getGreen() const
0...255
Object representing a RGB color, new version of jngl::Color (which will be deprecated in the future)
Definition Rgb.hpp:12
JNGL's main namespace.
Color interpolate(Color a, Color b, float t)
Returns a color mix between a (t == 0) and b (t == 1)
void setBackgroundColor(jngl::Rgb)
Sets the screen's background color which is visible when nothing is drawn.