diff --git a/src/bitmap.cpp b/src/bitmap.cpp index 43e8301..fa499ad 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -943,8 +943,8 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align) TTF_Font *font = p->font->getSdlFont(); const Color &fontColor = p->font->getColor(); - SDL_Color c; - fontColor.toSDLColor(c); + SDL_Color c = fontColor.toSDLColor(); + c.a = 255; float txtAlpha = fontColor.norm.w; diff --git a/src/etc.cpp b/src/etc.cpp index 14f8f4c..de8ab87 100644 --- a/src/etc.cpp +++ b/src/etc.cpp @@ -146,13 +146,15 @@ void Color::updateExternal() alpha = norm.w * 255; } -void Color::toSDLColor(SDL_Color &c) const +SDL_Color Color::toSDLColor() const { + SDL_Color c; c.r = clamp(red, 0, 255); c.g = clamp(green, 0, 255); c.b = clamp(blue, 0, 255); -// c.a = clamp(alpha, 0, 255); - c.a = 255; + c.a = clamp(alpha, 0, 255); + + return c; } diff --git a/src/etc.h b/src/etc.h index 3fba42f..eac48c5 100644 --- a/src/etc.h +++ b/src/etc.h @@ -79,7 +79,7 @@ struct Color : public Serializable return (alpha != 0); } - void toSDLColor(SDL_Color &c) const; + SDL_Color toSDLColor() const; /* Range (0.0 ~ 255.0) */ double red;