Cuberite
A lightweight, fast and extensible game server for Minecraft
Color.h
Go to the documentation of this file.
1 
2 // Color.h
3 
4 // Declares a class to handle item color related code
5 
6 
7 
8 
9 
10 #pragma once
11 
12 // tolua_begin
13 class cColor
14 {
15 public:
16 
17  enum eColorLimits : unsigned int
18  {
19  COLOR_MIN = 0,
20  COLOR_MAX = 255,
21  COLOR_LIMIT = 256,
22  COLOR_NONE = 0xFFFFFFFF,
23  };
24  cColor() { m_Color = static_cast<unsigned int>(COLOR_NONE);}
25  cColor(unsigned char a_Red, unsigned char a_Green, unsigned char a_Blue) { SetColor(a_Red, a_Green, a_Blue); }
26 
28  bool IsValid() const { return m_Color != COLOR_NONE; }
29 
30 
32  void SetColor(unsigned char a_Red, unsigned char a_Green, unsigned char a_Blue);
33 
35  void SetRed(unsigned char a_Red);
36 
38  void SetGreen(unsigned char a_Green);
39 
41  void SetBlue(unsigned char a_Blue);
42 
44  unsigned char GetRed() const;
45 
47  unsigned char GetGreen() const;
48 
50  unsigned char GetBlue() const;
51 
53  void Clear() { m_Color = static_cast<unsigned int>(COLOR_NONE); }
54  // tolua_end
55 
56  unsigned int m_Color;
57 
58 }; // tolua_export
Definition: Color.h:14
void SetColor(unsigned char a_Red, unsigned char a_Green, unsigned char a_Blue)
Changes the color.
Definition: Color.cpp:19
unsigned char GetRed() const
Returns the red value of the color.
Definition: Color.cpp:55
void SetBlue(unsigned char a_Blue)
Alters the blue value of the color.
Definition: Color.cpp:46
eColorLimits
Definition: Color.h:18
@ COLOR_LIMIT
Definition: Color.h:21
@ COLOR_NONE
Definition: Color.h:22
@ COLOR_MIN
Definition: Color.h:19
@ COLOR_MAX
Definition: Color.h:20
unsigned char GetGreen() const
Returns the green value of the color.
Definition: Color.cpp:64
void Clear()
Resets the color.
Definition: Color.h:53
void SetGreen(unsigned char a_Green)
Alters the green value of the color.
Definition: Color.cpp:37
cColor()
Definition: Color.h:24
unsigned char GetBlue() const
Returns the blue value of the color.
Definition: Color.cpp:73
unsigned int m_Color
Definition: Color.h:56
bool IsValid() const
Returns whether the color is a valid color.
Definition: Color.h:28
void SetRed(unsigned char a_Red)
Alters the red value of the color.
Definition: Color.cpp:28
cColor(unsigned char a_Red, unsigned char a_Green, unsigned char a_Blue)
Definition: Color.h:25