TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tb_color.hpp
1 
9 #ifndef TurtleBrains_Color_hpp
10 #define TurtleBrains_Color_hpp
11 
12 #include <turtle_brains/core/tb_types.hpp>
13 #include <turtle_brains/core/tb_dynamic_structure.hpp>
14 #include <turtle_brains/graphics/tb_color_palette.hpp>
15 
16 namespace TurtleBrains
17 {
18  namespace Graphics
19  {
24  class Color
25  {
26  public:
30  Color(void) noexcept;
31 
37  Color(const ColorPalette& colorFromPalette) noexcept;
38 
43  explicit Color(const tbCore::uint32& colorARGB) noexcept;
44 
56  explicit Color(const float clampedAlpha, const float clampedRed, const float clampedGreen, const float clampedBlue) noexcept;
57 
67  bool SetColor(const tbCore::DynamicStructure& colorData, bool triggerErrorOnFailure = true);
68 
73  void SetColor(const tbCore::uint32& colorARGB);
74 
86  void SetColor(const float clampedAlpha, const float clampedRed, const float clampedGreen, const float clampedBlue);
87 
98  void SetColor(const float clampedTween, const Color& startColor, const Color& finalColor);
99 
103  tbCore::uint32 GetColorARGB(void) const;
104 
108  tbCore::uint32 GetColorABGR(void) const;
109 
113  tbCore::uint8 GetAlphaByte(void) const;
114 
118  tbCore::uint8 GetRedByte(void) const;
119 
123  tbCore::uint8 GetGreenByte(void) const;
124 
128  tbCore::uint8 GetBlueByte(void) const;
129 
133  float GetAlpha(void) const;
134 
138  float GetRed(void) const;
139 
143  float GetGreen(void) const;
144 
148  float GetBlue(void) const;
149 
150  private:
151  //The floats may disappear for size reasons and use GetChannelAsFloat()
152  float mAlpha;
153  float mRed;
154  float mGreen;
155  float mBlue;
156 
157  tbCore::uint32 mARGB;
158  };
159 
160  }; /* namespace Graphics */
161 }; /* namespace TurtleBrains */
162 
164 
165 #endif /* TurtleBrains_Color_hpp */
tbCore::uint8 GetBlueByte(void) const
Give the GameScene and Entities something to display, Text, Sprites and AnimatedSprites help bring th...
tbCore::uint8 GetGreenByte(void) const
tbCore::uint32 GetColorARGB(void) const
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
tbCore::uint32 GetColorABGR(void) const
bool SetColor(const tbCore::DynamicStructure &colorData, bool triggerErrorOnFailure=true)
Definition: tb_color.hpp:24
float GetAlpha(void) const
tbCore::uint8 GetAlphaByte(void) const
uint8_t uint8
Unsigned integer with a size of 8 bits. Supports values from 0 to 255.
Definition: tb_types.hpp:23
tbCore::uint8 GetRedByte(void) const
ColorPalette
Definition: tb_color_palette.hpp:21
float GetRed(void) const
Definition: tb_dynamic_structure.hpp:37
uint32_t uint32
Unsigned integer with a size of 32 bits. Supports values from 0 to 4294967295, (2^32 - 1)...
Definition: tb_types.hpp:28
float GetBlue(void) const
float GetGreen(void) const