hedgewars/uRender.pas
changeset 9557 a5005b7ca305
parent 9080 9b42757d7e71
child 9666 8dcb25112d96
equal deleted inserted replaced
9555:485b424be769 9557:a5005b7ca305
    42 procedure DrawTextureRotatedF   (Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real);
    42 procedure DrawTextureRotatedF   (Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real);
    43 
    43 
    44 procedure DrawCircle            (X, Y, Radius, Width: LongInt);
    44 procedure DrawCircle            (X, Y, Radius, Width: LongInt);
    45 procedure DrawCircle            (X, Y, Radius, Width: LongInt; r, g, b, a: Byte);
    45 procedure DrawCircle            (X, Y, Radius, Width: LongInt; r, g, b, a: Byte);
    46 
    46 
       
    47 procedure DrawLine              (X0, Y0, X1, Y1, Width: Single; color: LongWord); inline;
    47 procedure DrawLine              (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
    48 procedure DrawLine              (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
    48 procedure DrawFillRect          (r: TSDL_Rect);
    49 procedure DrawFillRect          (r: TSDL_Rect);
    49 procedure DrawHedgehog          (X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
    50 procedure DrawHedgehog          (X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
    50 procedure DrawScreenWidget      (widget: POnScreenWidget);
    51 procedure DrawScreenWidget      (widget: POnScreenWidget);
    51 
    52 
   346     else
   347     else
   347         scale:= 1.0;
   348         scale:= 1.0;
   348     DrawTexture(X - round(Source^.w * scale) div 2, Top, Source, scale)
   349     DrawTexture(X - round(Source^.w * scale) div 2, Top, Source, scale)
   349 end;
   350 end;
   350 
   351 
       
   352 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; color: LongWord); inline;
       
   353 begin
       
   354 DrawLine(X0, Y0, X1, Y1, Width, (color shr 24) and $FF, (color shr 16) and $FF, (color shr 8) and $FF, color and $FF)
       
   355 end;
       
   356 
   351 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
   357 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
   352 var VertexBuffer: array [0..1] of TVertex2f;
   358 var VertexBuffer: array [0..1] of TVertex2f;
   353 begin
   359 begin
   354     glDisable(GL_TEXTURE_2D);
   360     glDisable(GL_TEXTURE_2D);
   355     glEnable(GL_LINE_SMOOTH);
   361     glEnable(GL_LINE_SMOOTH);
   531 end;
   537 end;
   532 
   538 
   533 procedure Tint(r, g, b, a: Byte); inline;
   539 procedure Tint(r, g, b, a: Byte); inline;
   534 var nc, tw: Longword;
   540 var nc, tw: Longword;
   535 begin
   541 begin
   536     nc:= (a shl 24) or (b shl 16) or (g shl 8) or r;
   542     nc:= (r shl 24) or (g shl 16) or (b shl 8) or a;
   537 
   543 
   538     if nc = lastTint then
   544     if nc = lastTint then
   539         exit;
   545         exit;
   540 
   546 
   541     if GrayScale then
   547     if GrayScale then
   552     lastTint:= nc;
   558     lastTint:= nc;
   553 end;
   559 end;
   554 
   560 
   555 procedure Tint(c: Longword); inline;
   561 procedure Tint(c: Longword); inline;
   556 begin
   562 begin
       
   563     if c = lastTint then exit;
   557     Tint(((c shr 24) and $FF), ((c shr 16) and $FF), (c shr 8) and $FF, (c and $FF))
   564     Tint(((c shr 24) and $FF), ((c shr 16) and $FF), (c shr 8) and $FF, (c and $FF))
   558 end;
   565 end;
   559 
   566 
   560 end.
   567 end.