515 function RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture; |
514 function RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture; |
516 var w, h: LongInt; |
515 var w, h: LongInt; |
517 Result: PSDL_Surface; |
516 Result: PSDL_Surface; |
518 begin |
517 begin |
519 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); |
518 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); |
|
519 |
520 Result:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + FontBorder * 2 + 4, h + FontBorder * 2, |
520 Result:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + FontBorder * 2 + 4, h + FontBorder * 2, |
521 32, RMask, GMask, BMask, AMask); |
521 32, RMask, GMask, BMask, AMask); |
|
522 |
522 TryDo(Result <> nil, 'RenderString: fail to create surface', true); |
523 TryDo(Result <> nil, 'RenderString: fail to create surface', true); |
|
524 |
523 WriteInRoundRect(Result, 0, 0, Color, font, s); |
525 WriteInRoundRect(Result, 0, 0, Color, font, s); |
|
526 |
524 TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
527 TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
|
528 |
525 RenderStringTex:= Surface2Tex(Result); |
529 RenderStringTex:= Surface2Tex(Result); |
|
530 |
526 SDL_FreeSurface(Result) |
531 SDL_FreeSurface(Result) |
527 end; |
532 end; |
528 |
533 |
529 procedure RenderHealth(var Hedgehog: THedgehog); |
534 procedure RenderHealth(var Hedgehog: THedgehog); |
530 var s: shortstring; |
535 var s: shortstring; |