hedgewars/uStore.pas
branchexperimental3D
changeset 4343 19cbea33e4d2
parent 4004 b1c2c2f6fc5e
parent 4279 b697a26ed538
child 4347 0ddb100fea61
equal deleted inserted replaced
4006:45b63c2a694f 4343:19cbea33e4d2
    59 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real);
    59 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real);
    60 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
    60 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
    61 procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
    61 procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
    62 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
    62 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
    63 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
    63 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
       
    64 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); 
    64 procedure DrawFillRect(r: TSDL_Rect);
    65 procedure DrawFillRect(r: TSDL_Rect);
    65 procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); 
    66 procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); 
    66 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
    67 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
    67 function  CheckCJKFont(s: ansistring; font: THWFont): THWFont;
    68 function  CheckCJKFont(s: ansistring; font: THWFont): THWFont;
    68 function  RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture;
    69 function  RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture;
   793 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   794 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   794 
   795 
   795 glPopMatrix
   796 glPopMatrix
   796 end;
   797 end;
   797 
   798 
       
   799 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
       
   800 var VertexBuffer: array [0..3] of TVertex2f;
       
   801 begin
       
   802     glDisable(GL_TEXTURE_2D);
       
   803     glEnable(GL_LINE_SMOOTH);
       
   804 
       
   805     glPushMatrix;
       
   806     glTranslatef(WorldDx, WorldDy, 0);
       
   807     glLineWidth(Width);
       
   808 
       
   809     Tint(r, g, b, a);
       
   810     VertexBuffer[0].X:= X0;
       
   811     VertexBuffer[0].Y:= Y0;
       
   812     VertexBuffer[1].X:= X1;
       
   813     VertexBuffer[1].Y:= Y1;
       
   814 
       
   815     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
   816     glDrawArrays(GL_LINES, 0, Length(VertexBuffer));
       
   817     Tint($FF, $FF, $FF, $FF);
       
   818     
       
   819     glPopMatrix;
       
   820     
       
   821     glEnable(GL_TEXTURE_2D);
       
   822     glDisable(GL_LINE_SMOOTH);
       
   823 end;
       
   824 
   798 procedure DrawFillRect(r: TSDL_Rect);
   825 procedure DrawFillRect(r: TSDL_Rect);
   799 var VertexBuffer: array [0..3] of TVertex2f;
   826 var VertexBuffer: array [0..3] of TVertex2f;
   800 begin
   827 begin
   801 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   828 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   802 if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then
   829 if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then
   834         CircleVertex[i].Y := Y + Radius*sin(i*pi/180);
   861         CircleVertex[i].Y := Y + Radius*sin(i*pi/180);
   835     end;
   862     end;
   836     glDisable(GL_TEXTURE_2D);
   863     glDisable(GL_TEXTURE_2D);
   837     glEnable(GL_LINE_SMOOTH);
   864     glEnable(GL_LINE_SMOOTH);
   838     glPushMatrix;
   865     glPushMatrix;
   839     glTranslatef(WorldDx, WorldDy, 0);
       
   840     glLineWidth(Width);
   866     glLineWidth(Width);
   841     Tint(r, g, b, a);
   867     Tint(r, g, b, a);
   842     glVertexPointer(2, GL_FLOAT, 0, @CircleVertex[0]);
   868     glVertexPointer(2, GL_FLOAT, 0, @CircleVertex[0]);
   843     glDrawArrays(GL_LINE_LOOP, 0, 360);
   869     glDrawArrays(GL_LINE_LOOP, 0, 360);
   844     Tint($FF, $FF, $FF, $FF);
   870     Tint($FF, $FF, $FF, $FF);
  1594 if (CurrentTeam <> nil) and (Ammoz[atype].SkipTurns >= CurrentTeam^.Clan^.TurnNumber) then // weapon or utility is not yet available
  1620 if (CurrentTeam <> nil) and (Ammoz[atype].SkipTurns >= CurrentTeam^.Clan^.TurnNumber) then // weapon or utility is not yet available
  1595     begin
  1621     begin
  1596     extra:= trmsg[sidNotYetAvailable];
  1622     extra:= trmsg[sidNotYetAvailable];
  1597     extracolor:= LongInt($ffc77070);
  1623     extracolor:= LongInt($ffc77070);
  1598     end
  1624     end
  1599 else if (Ammoz[atype].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0 then // weapon or utility won't end your turn
  1625 else if (Ammoz[atype].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then // weapon or utility won't end your turn
  1600     begin
  1626     begin
  1601     extra:= trmsg[sidNoEndTurn];
  1627     extra:= trmsg[sidNoEndTurn];
  1602     extracolor:= LongInt($ff70c770);
  1628     extracolor:= LongInt($ff70c770);
  1603     end
  1629     end
  1604 else
  1630 else