hedgewars/uStore.pas
changeset 2665 50b4e544c163
parent 2663 d53918cd22bb
child 2666 2b8c8f16421e
equal deleted inserted replaced
2664:949c189ba568 2665:50b4e544c163
   121 TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), w, h);
   121 TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), w, h);
   122 Result.x:= X;
   122 Result.x:= X;
   123 Result.y:= Y;
   123 Result.y:= Y;
   124 Result.w:= w + FontBorder * 2 + 4;
   124 Result.w:= w + FontBorder * 2 + 4;
   125 Result.h:= h + FontBorder * 2;
   125 Result.h:= h + FontBorder * 2;
   126 DrawRoundRect(@Result, cWhiteColor, cNearBlackColor, Surface, true);
   126 DrawRoundRect(@Result, cWhiteColor, cNearBlackColor.value, Surface, true);
   127 clr.r:= Color shr 16;
   127 clr.r:= Color shr 16;
   128 clr.g:= (Color shr 8) and $FF;
   128 clr.g:= (Color shr 8) and $FF;
   129 clr.b:= Color and $FF;
   129 clr.b:= Color and $FF;
   130 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr.value);
   130 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr);
   131 tmpsurf:= doSurfaceConversion(tmpsurf);
   131 tmpsurf:= doSurfaceConversion(tmpsurf);
   132 Result.x:= X + FontBorder + 2;
   132 Result.x:= X + FontBorder + 2;
   133 Result.y:= Y + FontBorder;
   133 Result.y:= Y + FontBorder;
   134 SDLTry(tmpsurf <> nil, true);
   134 SDLTry(tmpsurf <> nil, true);
   135 SDL_UpperBlit(tmpsurf, nil, Surface, @Result);
   135 SDL_UpperBlit(tmpsurf, nil, Surface, @Result);
   164 
   164 
   165 		texsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, r.w, r.h, 32, RMask, GMask, BMask, AMask);
   165 		texsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, r.w, r.h, 32, RMask, GMask, BMask, AMask);
   166 		TryDo(texsurf <> nil, errmsgCreateSurface, true);
   166 		TryDo(texsurf <> nil, errmsgCreateSurface, true);
   167 		TryDo(SDL_SetColorKey(texsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true);
   167 		TryDo(SDL_SetColorKey(texsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true);
   168 
   168 
   169 		DrawRoundRect(@r, cWhiteColor, cNearBlackColor, texsurf, true);
   169 		DrawRoundRect(@r, cWhiteColor, cNearBlackColor.value, texsurf, true);
   170 		rr:= r;
   170 		rr:= r;
   171 		inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4);
   171 		inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4);
   172 		DrawRoundRect(@rr, Clan^.Color, Clan^.Color, texsurf, false);
   172 		DrawRoundRect(@rr, Clan^.Color, Clan^.Color, texsurf, false);
   173 		HealthTex:= Surface2Tex(texsurf, false);
   173 		HealthTex:= Surface2Tex(texsurf, false);
   174 		SDL_FreeSurface(texsurf);
   174 		SDL_FreeSurface(texsurf);
   336 AddProgress;
   336 AddProgress;
   337 
   337 
   338 for ai:= Low(TAmmoType) to High(TAmmoType) do
   338 for ai:= Low(TAmmoType) to High(TAmmoType) do
   339 	with Ammoz[ai] do
   339 	with Ammoz[ai] do
   340 		begin
   340 		begin
   341 		tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(trAmmo[NameId]), cWhiteColor);
   341 		tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels);
   342 		tmpsurf:= doSurfaceConversion(tmpsurf);
       
   343 		NameTex:= Surface2Tex(tmpsurf, false);
   342 		NameTex:= Surface2Tex(tmpsurf, false);
   344 		SDL_FreeSurface(tmpsurf)
   343 		SDL_FreeSurface(tmpsurf)
   345 		end;
   344 		end;
   346 
   345 
   347 for i:= Low(CountTexz) to High(CountTexz) do
   346 for i:= Low(CountTexz) to High(CountTexz) do
   348 	begin
   347 	begin
   349 	tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColor);
   348 	tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels);
   350 	tmpsurf:= doSurfaceConversion(tmpsurf);	
       
   351 	CountTexz[i]:= Surface2Tex(tmpsurf, false);
   349 	CountTexz[i]:= Surface2Tex(tmpsurf, false);
   352 	SDL_FreeSurface(tmpsurf)
   350 	SDL_FreeSurface(tmpsurf)
   353 	end;
   351 	end;
   354 
   352 
   355 {$IFDEF DUMP}
   353 {$IFDEF DUMP}
   935         if s[pos] <> #1 then inc(pos);
   933         if s[pos] <> #1 then inc(pos);
   936         while s[prevpos+1] = ' 'do inc(prevpos);
   934         while s[prevpos+1] = ' 'do inc(prevpos);
   937         substr:= copy(s, prevpos+1, pos-prevpos-1);
   935         substr:= copy(s, prevpos+1, pos-prevpos-1);
   938         if Length(substr) <> 0 then
   936         if Length(substr) <> 0 then
   939            begin
   937            begin
   940            tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(substr), 
   938            tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(substr), cNearBlackColor);
   941 {$IFDEF ENDIAN_LITTLE}
       
   942 		cNearBlackColor
       
   943 {$ELSE}
       
   944 		$100000FF
       
   945 {$ENDIF}
       
   946 		); // do not remove me
       
   947 	   tmpsurf:= doSurfaceConversion(tmpsurf);
       
   948            rect.x:= edgeHeight + 1 + ((i - w) div 2);
   939            rect.x:= edgeHeight + 1 + ((i - w) div 2);
   949            // trying to more evenly position the text, vertically
   940            // trying to more evenly position the text, vertically
   950            rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h;
   941            rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h;
   951            SDLTry(tmpsurf <> nil, true);
   942            SDLTry(tmpsurf <> nil, true);
   952            SDL_UpperBlit(tmpsurf, nil, Result, @rect);
   943            SDL_UpperBlit(tmpsurf, nil, Result, @rect);