From 8797569d33c4917eb8f8a1dc2341aac7b5815315 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sun, 22 Jul 2012 22:05:12 +0200 Subject: 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 --- src/graphics/common/color.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/graphics/common/color.h') 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 const float* 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; + } }; /** -- cgit v1.2.3-1-g7c22