hedgewars/uRender.pas
changeset 5559 a937d43a032f
parent 5441 39962b855540
child 5561 dfbe55237c64
equal deleted inserted replaced
5558:49cfd05ccb83 5559:a937d43a032f
    48 var
    48 var
    49     HHTexture: PTexture;
    49     HHTexture: PTexture;
    50 
    50 
    51 implementation
    51 implementation
    52 uses uVariables;
    52 uses uVariables;
    53 var
       
    54     lastTint: Longword;
       
    55 
    53 
    56 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt);
    54 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt);
    57 begin
    55 begin
    58 r.y:= r.y + Height * Position;
    56 r.y:= r.y + Height * Position;
    59 r.h:= Height;
    57 r.h:= Height;
   451     glPopMatrix
   449     glPopMatrix
   452 end;
   450 end;
   453 
   451 
   454 
   452 
   455 procedure Tint(r, g, b, a: Byte); inline;
   453 procedure Tint(r, g, b, a: Byte); inline;
   456 var nc, tw: Longword;
   454 const 
       
   455     lastTint: Longword = 0;
       
   456 var 
       
   457     nc, tw: Longword;
   457 begin
   458 begin
   458 nc:= (a shl 24) or (b shl 16) or (g shl 8) or r;
   459 nc:= (a shl 24) or (b shl 16) or (g shl 8) or r;
       
   460 
   459 if nc = lastTint then
   461 if nc = lastTint then
   460     exit;
   462     exit;
       
   463 
   461 if cGrayScale then
   464 if cGrayScale then
   462     begin
   465     begin
   463     tw:= round(r * RGB_LUMINANCE_RED + g * RGB_LUMINANCE_GREEN + b * RGB_LUMINANCE_BLUE);
   466     tw:= round(r * RGB_LUMINANCE_RED + g * RGB_LUMINANCE_GREEN + b * RGB_LUMINANCE_BLUE);
   464     if tw > 255 then tw:= 255;
   467     if tw > 255 then tw:= 255;
   465     r:= tw;
   468     r:= tw;