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/texture.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/texture.h')
-rw-r--r-- | src/graphics/common/texture.h | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/graphics/common/texture.h b/src/graphics/common/texture.h index fa374ac..83986ea 100644 --- a/src/graphics/common/texture.h +++ b/src/graphics/common/texture.h @@ -166,9 +166,48 @@ struct Texture bool valid; //! Id of the texture in graphics engine unsigned int id; + //! Width of texture + int width; + //! Height of texture + int height; + //! Whether the texture has alpha channel + bool alpha; Texture() - { valid = false; id = 0; } + { + valid = false; + id = 0; + width = height = 0; + alpha = false; + } + + //! Comparator for use in texture maps and sets + inline bool operator<(const Gfx::Texture &other) const + { + // Invalid textures are always "less than" every other texture + + if ( (!valid) && (!other.valid) ) + return false; + + if (!valid) + return true; + + if (!other.valid) + return false; + + return id < other.id; + } + + //! Comparator + inline bool operator==(const Gfx::Texture &other) const + { + if (valid != other.valid) + return false; + if ( (!valid) && (!other.valid) ) + return true; + + return id == other.id; + } }; }; // namespace Gfx |