hedgewars/uStore.pas
changeset 108 08f1fe6f21f8
parent 107 b08ce0293a51
child 161 d8870bbf960e
equal deleted inserted replaced
107:b08ce0293a51 108:08f1fe6f21f8
    47 procedure DXOutText(X, Y: Integer; Font: THWFont; s: string; Surface: PSDL_Surface);
    47 procedure DXOutText(X, Y: Integer; Font: THWFont; s: string; Surface: PSDL_Surface);
    48 procedure DrawCaption(X, Y: integer; Rect: TSDL_Rect; Surface: PSDL_Surface);
    48 procedure DrawCaption(X, Y: integer; Rect: TSDL_Rect; Surface: PSDL_Surface);
    49 procedure DrawCentered(X, Top: integer; Source, Surface: PSDL_Surface);
    49 procedure DrawCentered(X, Top: integer; Source, Surface: PSDL_Surface);
    50 procedure DrawFromStoreRect(X, Y: integer; Rect: PSDL_Rect; Surface: PSDL_Surface);
    50 procedure DrawFromStoreRect(X, Y: integer; Rect: PSDL_Rect; Surface: PSDL_Surface);
    51 procedure DrawHedgehog(X, Y: integer; Dir: integer; Pos, Step: LongWord; Surface: PSDL_Surface);
    51 procedure DrawHedgehog(X, Y: integer; Dir: integer; Pos, Step: LongWord; Surface: PSDL_Surface);
    52 function  RenderString(var s: shortstring; Color: integer; font: THWFont): PSDL_Surface;
    52 function  RenderString(s: string; Color: integer; font: THWFont): PSDL_Surface;
    53 procedure RenderHealth(var Hedgehog: THedgehog);
    53 procedure RenderHealth(var Hedgehog: THedgehog);
    54 procedure AddProgress;
    54 procedure AddProgress;
    55 function  LoadImage(filename: string; hasAlpha: boolean; const critical: boolean = true): PSDL_Surface;
    55 function  LoadImage(filename: string; hasAlpha: boolean; const critical: boolean = true): PSDL_Surface;
    56 
    56 
    57 var PixelFormat: PSDL_PixelFormat;
    57 var PixelFormat: PSDL_PixelFormat;
   442 SDL_FreeSurface(  HHSurface  );
   442 SDL_FreeSurface(  HHSurface  );
   443 SDL_FreeSurface(LandSurface  );
   443 SDL_FreeSurface(LandSurface  );
   444 SDL_FreeSurface(StoreSurface )
   444 SDL_FreeSurface(StoreSurface )
   445 end;
   445 end;
   446 
   446 
   447 function RenderString(var s: shortstring; Color: integer; font: THWFont): PSDL_Surface;
   447 function  RenderString(s: string; Color: integer; font: THWFont): PSDL_Surface;
   448 var w, h: integer;
   448 var w, h: integer;
   449 begin
   449 begin
   450 TTF_SizeUTF8(Fontz[font].Handle, PChar(String(s)), w, h);
   450 TTF_SizeUTF8(Fontz[font].Handle, PChar(s), w, h);
   451 Result:= SDL_CreateRGBSurface(SDL_HWSURFACE, w + 6, h + 2, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
   451 Result:= SDL_CreateRGBSurface(SDL_HWSURFACE, w + 6, h + 2, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
   452 TryDo(Result <> nil, 'RenderString: fail to create surface', true);
   452 TryDo(Result <> nil, 'RenderString: fail to create surface', true);
   453 WriteInRoundRect(Result, 0, 0, Color, font, s);
   453 WriteInRoundRect(Result, 0, 0, Color, font, s);
   454 TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY or SDL_RLEACCEL, 0) = 0, errmsgTransparentSet, true)
   454 TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY or SDL_RLEACCEL, 0) = 0, errmsgTransparentSet, true)
   455 end;
   455 end;