equal
deleted
inserted
replaced
88 var strSurface, |
88 var strSurface, |
89 resSurface: PSDL_Surface; |
89 resSurface: PSDL_Surface; |
90 dstrect : TSDL_Rect; // destination rectangle for blitting |
90 dstrect : TSDL_Rect; // destination rectangle for blitting |
91 font : THWFont; |
91 font : THWFont; |
92 const |
92 const |
93 shadowcolor: TSDL_Color = (r:$00; g:$00; b:$00; a:$80); |
93 //shadowcolor: TSDL_Color = (r:$00; g:$00; b:$00; a:$FF); |
|
94 //shadowcolor: TSDL_Color = (r:$00; g:$00; b:$00; a:$80); |
94 shadowint = $80 shl AShift; |
95 shadowint = $80 shl AShift; |
95 begin |
96 begin |
96 |
97 |
97 font:= CheckCJKFont(ansistring(str), fnt16); |
98 font:= CheckCJKFont(ansistring(str), fnt16); |
98 |
99 |
113 dstrect.w:= cl.Width; |
114 dstrect.w:= cl.Width; |
114 dstrect.h:= ClHeight; |
115 dstrect.h:= ClHeight; |
115 |
116 |
116 // draw background |
117 // draw background |
117 SDL_FillRect(resSurface, @dstrect, shadowint); |
118 SDL_FillRect(resSurface, @dstrect, shadowint); |
118 |
119 (* |
|
120 So, using Text/Blended + Shadow/Solid or shadow with shadowcolor alpha of FF seemed to make shadow disappear here. |
|
121 At least, I didn't see any difference, and no changing of the padding offset let me view it. Just disabling it. |
119 // prepare destination rectangle for text shadow |
122 // prepare destination rectangle for text shadow |
120 // start position in texture should have padding; add 1 px as shadow offset |
123 // start position in texture should have padding; add 1 px as shadow offset |
121 dstrect.x:= Padding + 1; |
124 dstrect.x:= Padding + 1; |
122 dstrect.y:= Padding + 1; |
125 dstrect.y:= Padding + 1; |
123 // doesn't matter if .w and .h still include padding, SDL_UpperBlit will clip |
126 // doesn't matter if .w and .h still include padding, SDL_UpperBlit will clip |
125 |
128 |
126 // create and blit text shadow |
129 // create and blit text shadow |
127 strSurface:= TTF_RenderUTF8_Blended(Fontz[font].Handle, Str2PChar(str), shadowcolor); |
130 strSurface:= TTF_RenderUTF8_Blended(Fontz[font].Handle, Str2PChar(str), shadowcolor); |
128 SDL_UpperBlit(strSurface, nil, resSurface, @dstrect); |
131 SDL_UpperBlit(strSurface, nil, resSurface, @dstrect); |
129 SDL_FreeSurface(strSurface); |
132 SDL_FreeSurface(strSurface); |
|
133 *) |
130 |
134 |
131 // non-shadow text starts at padding |
135 // non-shadow text starts at padding |
132 dstrect.x:= Padding; |
136 dstrect.x:= Padding; |
133 dstrect.y:= Padding; |
137 dstrect.y:= Padding; |
134 |
138 |