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 | 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 | 73 | // Grab the current color |
| 74 | 74 | float currentColor[4]; |
| 75 | 75 | glGetFloatv(GL_CURRENT_COLOR, currentColor); |
| 76 | − int compactColor = ((int( currentColor[0] * 255.f) & 0xFF)) | | |
| 77 | − ((int( currentColor[1] * 255.f) & 0xFF) << 8) | | |
| 78 | − ((int( currentColor[2] * 255.f) & 0xFF) << 16) | | |
| 79 | − ((int( currentColor[3] * 255.f) & 0xFF) << 24); | |
| 76 | + alpha = std::max(0.f, std::min(alpha, 1.f)); | |
| 77 | + currentColor[3] *= alpha; | |
| 78 | + int compactColor = ((int(currentColor[0] * 255.f) & 0xFF)) | | |
| 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 | 83 | // TODO: Remove that code once we test for performance improvments |
| 82 | 84 | //glEnable(GL_TEXTURE_2D); |