Changeset 8324 in orxonox.OLD for trunk/src/lib/gui/gl/glgui_cursor.cc
- Timestamp:
- Jun 12, 2006, 12:40:57 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/gui/gl/glgui_cursor.cc
r8312 r8324 20 20 #include "glgui_handler.h" 21 21 #include "color.h" 22 #include "texture_sequence.h"23 #include "loading/resource_manager.h" // HACK24 22 25 23 namespace OrxGui … … 67 65 this->color = 0.0f; 68 66 69 this-> seq = new TextureSequence();70 this->seq->loadImageSeries(ResourceManager::getInstance()->getDataDir() + "/maps/reap_mouse/reap_mouse_##.tif", 0, 49);67 this->resize(); 68 } 71 69 72 this->resize(); 70 /** 71 * @brief Loads an Image-Series onto the Cursor. 72 * @param imageNameSubstitue The Prefix of the Image 73 * @param from From which image 74 * @param to To which image 75 * @return true on success. 76 * 77 * @see TextureSequence:: loadTextureSequence(const std::string& imageNameSubstitue, unsigned int from, unsigned int to) 78 */ 79 bool GLGuiCursor::loadTextureSequence(const std::string& imageNameSubstitue, unsigned int from, unsigned int to) 80 { 81 this->backMaterial().setDiffuse(1.0, 1.0, 1.0); 82 return this->seq.loadImageSeries(imageNameSubstitue, from, to); 73 83 } 74 84 75 85 void GLGuiCursor::tick(float dt) 76 86 { 77 this->frameNumber += 25.0*dt; 78 if (frameNumber >= this->seq->getFrameCount()) 79 frameNumber = 0.0; 80 81 this->color += dt*10.0; 82 if (this->color > 360.0) 83 this->color -= 360.0; 84 Vector color = Color::HSVtoRGB(Vector(this->color, 1.0, 1.0)); 85 this->backMaterial().setDiffuse(color.x, color.y, color.z); 86 87 if (!this->seq.empty()) 88 { 89 this->frameNumber += 25.0*dt; 90 if (frameNumber >= this->seq.getFrameCount()) 91 frameNumber = 0.0; 92 } 93 else 94 { 95 this->color += dt*10.0; 96 if (this->color > 360.0) 97 this->color -= 360.0; 98 Vector color = Color::HSVtoRGB(Vector(this->color, 1.0, 1.0)); 99 this->backMaterial().setDiffuse(color.x, color.y, color.z); 100 } 87 101 //if (this->movement != Vector2D()) 88 102 { … … 110 124 { 111 125 this->beginDraw(); 112 // HACK 113 glActiveTexture(GL_TEXTURE0); 114 glEnable(GL_TEXTURE_2D); 115 glBindTexture(GL_TEXTURE_2D, this->seq->getFrameTexture((int)frameNumber)); 116 glColor3f(1,1,1); 117 glEnable(GL_BLEND); 118 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 126 127 this->backMaterial().select(); 128 if (!this->seq.empty()) 129 glBindTexture(GL_TEXTURE_2D, this->seq.getFrameTexture((int)frameNumber)); 119 130 this->drawRect(this->backRect()); 120 131 … … 123 134 } 124 135 136 /** 137 * @brief processes Events from the EventHandler. 138 * @param event the Event to process. 139 */ 125 140 void GLGuiCursor::process(const Event& event) 126 141 {
Note: See TracChangeset
for help on using the changeset viewer.