diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-22 22:05:12 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-22 22:05:12 +0200 |
commit | 8797569d33c4917eb8f8a1dc2341aac7b5815315 (patch) | |
tree | 839aca030b0d3ed36cef15b051fbfd4bf8ecb754 /src/graphics/common/color.h | |
parent | 86ea086790a677d6de6a836e7562814d3ba30bd1 (diff) | |
download | colobot-8797569d33c4917eb8f8a1dc2341aac7b5815315.tar.gz colobot-8797569d33c4917eb8f8a1dc2341aac7b5815315.tar.bz2 colobot-8797569d33c4917eb8f8a1dc2341aac7b5815315.zip |
Texture & mouse functions; refactoring & fixes
- cleaned up and added documentation to engine.h
- refactored CEngine interface and associated structs
- added mouse handling functions in CApplication & CEngine
- fixed bugs in projection matrix setting
- changed texture loading & handling
- added const-values in CDevice & CGLDevice
- changed event management in CApplication
- other minor changes & bugfixes
Diffstat (limited to 'src/graphics/common/color.h')
-rw-r--r-- | src/graphics/common/color.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/graphics/common/color.h b/src/graphics/common/color.h index 68421c7..907a3b9 100644 --- a/src/graphics/common/color.h +++ b/src/graphics/common/color.h @@ -36,12 +36,23 @@ struct Color Color(float aR = 0.0f, float aG = 0.0f, float aB = 0.0f, float aA = 0.0f) : r(aR), g(aG), b(aB), a(aA) {} + inline Gfx::Color Inverse() const + { + return Gfx::Color(1.0f - r, 1.0f - g, 1.0f - b, 1.0f - a); + } + //! Returns the struct cast to \c float* array; use with care! inline float* Array() { return (float*)this; } + //! Returns the struct cast to <tt>const float*</tt> array; use with care! + inline const float* Array() const + { + return (const float*)this; + } + //! Returns a string (r, g, b, a) inline std::string ToString() const { @@ -50,6 +61,11 @@ struct Color s << "(" << r << ", " << g << ", " << b << ", " << a << ")"; return s.str(); } + + inline bool operator==(const Gfx::Color &other) const + { + return r == other.r && g == other.g && b == other.b && a == other.a; + } }; /** |