diff options
-rw-r--r-- | src/ui/paint.c | 5 | ||||
-rw-r--r-- | src/ui/paint.h | 1 | ||||
-rw-r--r-- | src/ui/text.c | 6 | ||||
-rw-r--r-- | src/ui/text.h | 2 |
4 files changed, 11 insertions, 3 deletions
diff --git a/src/ui/paint.c b/src/ui/paint.c index d0a4a579..9c6711f1 100644 --- a/src/ui/paint.c +++ b/src/ui/paint.c | |||
@@ -31,13 +31,14 @@ iLocalDef SDL_Renderer *renderer_Paint_(const iPaint *d) { | |||
31 | 31 | ||
32 | static void setColor_Paint_(const iPaint *d, int color) { | 32 | static void setColor_Paint_(const iPaint *d, int color) { |
33 | const iColor clr = get_Color(color & mask_ColorId); | 33 | const iColor clr = get_Color(color & mask_ColorId); |
34 | SDL_SetRenderDrawColor(renderer_Paint_(d), clr.r, clr.g, clr.b, clr.a); | 34 | SDL_SetRenderDrawColor(renderer_Paint_(d), clr.r, clr.g, clr.b, clr.a * d->alpha / 255); |
35 | } | 35 | } |
36 | 36 | ||
37 | void init_Paint(iPaint *d) { | 37 | void init_Paint(iPaint *d) { |
38 | d->dst = get_Window(); | 38 | d->dst = get_Window(); |
39 | d->setTarget = NULL; | 39 | d->setTarget = NULL; |
40 | d->oldTarget = NULL; | 40 | d->oldTarget = NULL; |
41 | d->alpha = 255; | ||
41 | } | 42 | } |
42 | 43 | ||
43 | void beginTarget_Paint(iPaint *d, SDL_Texture *target) { | 44 | void beginTarget_Paint(iPaint *d, SDL_Texture *target) { |
diff --git a/src/ui/paint.h b/src/ui/paint.h index 28931815..89a01da6 100644 --- a/src/ui/paint.h +++ b/src/ui/paint.h | |||
@@ -33,6 +33,7 @@ struct Impl_Paint { | |||
33 | iWindow * dst; | 33 | iWindow * dst; |
34 | SDL_Texture *setTarget; | 34 | SDL_Texture *setTarget; |
35 | SDL_Texture *oldTarget; | 35 | SDL_Texture *oldTarget; |
36 | uint8_t alpha; | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | void init_Paint (iPaint *); | 39 | void init_Paint (iPaint *); |
diff --git a/src/ui/text.c b/src/ui/text.c index 8d4661ac..b2110bb6 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -302,6 +302,10 @@ void deinit_Text(void) { | |||
302 | iRelease(d->ansiEscape); | 302 | iRelease(d->ansiEscape); |
303 | } | 303 | } |
304 | 304 | ||
305 | void setOpacity_Text(float opacity) { | ||
306 | SDL_SetTextureAlphaMod(text_.cache, iClamp(opacity, 0.0f, 1.0f) * 255 + 0.5f); | ||
307 | } | ||
308 | |||
305 | void setContentFontSize_Text(float fontSizeFactor) { | 309 | void setContentFontSize_Text(float fontSizeFactor) { |
306 | fontSizeFactor *= contentScale_Text_; | 310 | fontSizeFactor *= contentScale_Text_; |
307 | iAssert(fontSizeFactor > 0); | 311 | iAssert(fontSizeFactor > 0); |
@@ -490,7 +494,7 @@ static enum iFontId fontId_Text_(const iFont *font) { | |||
490 | } | 494 | } |
491 | 495 | ||
492 | iLocalDef iBool isWrapBoundary_(iChar a, iChar b) { | 496 | iLocalDef iBool isWrapBoundary_(iChar a, iChar b) { |
493 | if (b == '/' || b == '-' || b == ',' || b == ';' || b == ':') { | 497 | if (b == '/' || b == '-' || b == ',' || b == ';' || b == ':' || b == '.') { |
494 | return iTrue; | 498 | return iTrue; |
495 | } | 499 | } |
496 | return !isSpace_Char(a) && isSpace_Char(b); | 500 | return !isSpace_Char(a) && isSpace_Char(b); |
diff --git a/src/ui/text.h b/src/ui/text.h index 7dc4aa38..71c2ba43 100644 --- a/src/ui/text.h +++ b/src/ui/text.h | |||
@@ -130,6 +130,8 @@ enum iAlignment { | |||
130 | right_Alignment, | 130 | right_Alignment, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | void setOpacity_Text (float opacity); | ||
134 | |||
133 | void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...); | 135 | void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...); |
134 | void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); | 136 | void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); |
135 | void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); | 137 | void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); |