hedgewars/uStore.pas
changeset 821 e6c0408b54ed
parent 809 b33c2def1576
child 822 2ae8fd8ef804
equal deleted inserted replaced
820:a26537586400 821:e6c0408b54ed
    34 procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame: LongInt; Angle: real);
    34 procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame: LongInt; Angle: real);
    35 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y: LongInt; Angle: real);
    35 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y: LongInt; Angle: real);
    36 procedure DXOutText(X, Y: LongInt; Font: THWFont; s: string; Surface: PSDL_Surface);
    36 procedure DXOutText(X, Y: LongInt; Font: THWFont; s: string; Surface: PSDL_Surface);
    37 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
    37 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
    38 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture; DestSurface: PSDL_Surface);
    38 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture; DestSurface: PSDL_Surface);
    39 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Surface: PSDL_Surface);
    39 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
    40 function  RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture;
    40 function  RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture;
    41 procedure RenderHealth(var Hedgehog: THedgehog);
    41 procedure RenderHealth(var Hedgehog: THedgehog);
    42 procedure AddProgress;
    42 procedure AddProgress;
    43 procedure FinishProgress;
    43 procedure FinishProgress;
    44 function  LoadImage(const filename: string; hasAlpha, critical, setTransparent: boolean): PSDL_Surface;
    44 function  LoadImage(const filename: string; hasAlpha, critical, setTransparent: boolean): PSDL_Surface;
   469 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
   469 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
   470 begin
   470 begin
   471 DrawTexture(X - Source^.w div 2, Top, Source)
   471 DrawTexture(X - Source^.w div 2, Top, Source)
   472 end;
   472 end;
   473 
   473 
   474 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Surface: PSDL_Surface);
   474 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
   475 var l, r, t, b: real;
   475 var l, r, t, b: real;
   476 begin
   476 begin
   477 
   477 
   478 t:= Pos * 32 / HHTexture^.h;
   478 t:= Pos * 32 / HHTexture^.h;
   479 b:= (Pos + 1) * 32 / HHTexture^.h;
   479 b:= (Pos + 1) * 32 / HHTexture^.h;
   486    begin
   486    begin
   487    l:= Step * 32 / HHTexture^.w;
   487    l:= Step * 32 / HHTexture^.w;
   488    r:= (Step + 1) * 32 / HHTexture^.w
   488    r:= (Step + 1) * 32 / HHTexture^.w
   489    end;
   489    end;
   490 
   490 
       
   491 
       
   492 glPushMatrix();
       
   493 glTranslatef(X, Y, 0);
       
   494 glRotatef(Angle, 0, 0, 1);
       
   495 
   491 glBindTexture(GL_TEXTURE_2D, HHTexture^.id);
   496 glBindTexture(GL_TEXTURE_2D, HHTexture^.id);
   492 
   497 
   493 glBegin(GL_QUADS);
   498 glBegin(GL_QUADS);
   494 
   499 
   495 glTexCoord2f(l, t);
   500 glTexCoord2f(l, t);
   496 glVertex2i(X, Y);
   501 glVertex2i(-16, -16);
   497 
   502 
   498 glTexCoord2f(r, t);
   503 glTexCoord2f(r, t);
   499 glVertex2i(32 + X, Y);
   504 glVertex2i(16, -16);
   500 
   505 
   501 glTexCoord2f(r, b);
   506 glTexCoord2f(r, b);
   502 glVertex2i(32 + X, 32 + Y);
   507 glVertex2i(16, 16);
   503 
   508 
   504 glTexCoord2f(l, b);
   509 glTexCoord2f(l, b);
   505 glVertex2i(X, 32 + Y);
   510 glVertex2i(-16, 16);
   506 
   511 
   507 glEnd()
   512 glEnd();
       
   513 
       
   514 glPopMatrix
   508 end;
   515 end;
   509 
   516 
   510 procedure StoreRelease;
   517 procedure StoreRelease;
   511 var ii: TSprite;
   518 var ii: TSprite;
   512 begin
   519 begin