Showing the changes to interface/src/ui/TextRenderer.cpp (1 of 5 files). Show all
Unified · Split
| @@ -69,14 +69,16 @@ int TextRenderer::calculateHeight(const char* str) { · 68 unmodified lines | |||
| 69 | return maxHeight; | 69 | return maxHeight; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | int TextRenderer::draw(int x, int y, const char* str) { | 72 | int TextRenderer::draw(int x, int y, const char* str, float alpha) { |
| 73 | // Grab the current color | 73 | // Grab the current color |
| 74 | float currentColor[4]; | 74 | float currentColor[4]; |
| 75 | glGetFloatv(GL_CURRENT_COLOR, currentColor); | 75 | glGetFloatv(GL_CURRENT_COLOR, currentColor); |
| 76 | int compactColor = ((int( currentColor[0] * 255.f) & 0xFF)) | | 76 | alpha = std::max(0.f, std::min(alpha, 1.f)); |
| 77 | ((int( currentColor[1] * 255.f) & 0xFF) << 8) | | 77 | currentColor[3] *= alpha; |
| 78 | ((int( currentColor[2] * 255.f) & 0xFF) << 16) | | 78 | int compactColor = ((int(currentColor[0] * 255.f) & 0xFF)) | |
| 79 | ((int( currentColor[3] * 255.f) & 0xFF) << 24); | 79 | ((int(currentColor[1] * 255.f) & 0xFF) << 8) | |
| 80 | ((int(currentColor[2] * 255.f) & 0xFF) << 16) | | ||
| 81 | ((int(currentColor[3] * 255.f) & 0xFF) << 24); | ||
| 80 | 82 | ||
| 81 | // TODO: Remove that code once we test for performance improvments | 83 | // TODO: Remove that code once we test for performance improvments |
| 82 | //glEnable(GL_TEXTURE_2D); | 84 | //glEnable(GL_TEXTURE_2D); |