hedgewars/uStore.pas
changeset 4279 b697a26ed538
parent 4241 835fd7a0e1bf
child 4343 19cbea33e4d2
child 4357 a1fcfc341a52
equal deleted inserted replaced
4277:d699d23a6e1d 4279:b697a26ed538
    55 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real);
    55 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real);
    56 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
    56 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
    57 procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
    57 procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
    58 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
    58 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
    59 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
    59 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
       
    60 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); 
    60 procedure DrawFillRect(r: TSDL_Rect);
    61 procedure DrawFillRect(r: TSDL_Rect);
    61 procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); 
    62 procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); 
    62 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
    63 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
    63 function  CheckCJKFont(s: ansistring; font: THWFont): THWFont;
    64 function  CheckCJKFont(s: ansistring; font: THWFont): THWFont;
    64 function  RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture;
    65 function  RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture;
   789 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   790 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   790 
   791 
   791 glPopMatrix
   792 glPopMatrix
   792 end;
   793 end;
   793 
   794 
       
   795 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
       
   796 var VertexBuffer: array [0..3] of TVertex2f;
       
   797 begin
       
   798     glDisable(GL_TEXTURE_2D);
       
   799     glEnable(GL_LINE_SMOOTH);
       
   800 
       
   801     glPushMatrix;
       
   802     glTranslatef(WorldDx, WorldDy, 0);
       
   803     glLineWidth(Width);
       
   804 
       
   805     Tint(r, g, b, a);
       
   806     VertexBuffer[0].X:= X0;
       
   807     VertexBuffer[0].Y:= Y0;
       
   808     VertexBuffer[1].X:= X1;
       
   809     VertexBuffer[1].Y:= Y1;
       
   810 
       
   811     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
   812     glDrawArrays(GL_LINES, 0, Length(VertexBuffer));
       
   813     Tint($FF, $FF, $FF, $FF);
       
   814     
       
   815     glPopMatrix;
       
   816     
       
   817     glEnable(GL_TEXTURE_2D);
       
   818     glDisable(GL_LINE_SMOOTH);
       
   819 end;
       
   820 
   794 procedure DrawFillRect(r: TSDL_Rect);
   821 procedure DrawFillRect(r: TSDL_Rect);
   795 var VertexBuffer: array [0..3] of TVertex2f;
   822 var VertexBuffer: array [0..3] of TVertex2f;
   796 begin
   823 begin
   797 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   824 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   798 if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then
   825 if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then