hedgewars/uStore.pas
changeset 1242 4aca5f7b2504
parent 1185 a17732fbaf35
child 1251 1f545d9a10ca
equal deleted inserted replaced
1241:9a2def515c98 1242:4aca5f7b2504
    28 procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt);
    28 procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt);
    29 procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt);
    29 procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt);
    30 procedure DrawSurfSprite(X, Y, Height, Frame: LongInt; Source: PTexture);
    30 procedure DrawSurfSprite(X, Y, Height, Frame: LongInt; Source: PTexture);
    31 procedure DrawLand (X, Y: LongInt);
    31 procedure DrawLand (X, Y: LongInt);
    32 procedure DrawTexture(X, Y: LongInt; Texture: PTexture);
    32 procedure DrawTexture(X, Y: LongInt; Texture: PTexture);
       
    33 procedure DrawTextureF(Texture: PTexture; X, Y, Frame, Dir, Frames: LongInt);
    33 procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
    34 procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
    34 procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real);
    35 procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real);
    35 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real);
    36 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real);
    36 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
    37 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
    37 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
    38 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
   151 		dec(drY, r.h + 2);
   152 		dec(drY, r.h + 2);
   152 		DrawHealthY:= drY;
   153 		DrawHealthY:= drY;
   153 		for i:= 0 to 7 do
   154 		for i:= 0 to 7 do
   154 			with Hedgehogs[i] do
   155 			with Hedgehogs[i] do
   155 				if Gear <> nil then
   156 				if Gear <> nil then
       
   157 					begin
   156 					NameTagTex:= RenderStringTex(Name, Clan^.Color, fnt16);
   158 					NameTagTex:= RenderStringTex(Name, Clan^.Color, fnt16);
       
   159 					texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, false, true, false);
       
   160 					HatTex:= Surface2Tex(texsurf);
       
   161 					SDL_FreeSurface(texsurf)
       
   162 					end;
   157 		end;
   163 		end;
   158 	end;
   164 	end;
   159 
   165 
   160 	procedure MakeCrossHairs;
   166 	procedure MakeCrossHairs;
   161 	var t: LongInt;
   167 	var t: LongInt;
   349 glVertex2i(X, Texture^.h + Y);
   355 glVertex2i(X, Texture^.h + Y);
   350 
   356 
   351 glEnd()
   357 glEnd()
   352 end;
   358 end;
   353 
   359 
       
   360 procedure DrawTextureF(Texture: PTexture; X, Y, Frame, Dir, Frames: LongInt);
       
   361 var ft, fb: GLfloat;
       
   362 	hw: LongInt;
       
   363 begin
       
   364 glPushMatrix;
       
   365 glTranslatef(X, Y, 0);
       
   366 
       
   367 if Dir < 0 then
       
   368 	hw:= - 16
       
   369 else
       
   370 	hw:= 16;
       
   371 
       
   372 ft:= Frame / Frames;
       
   373 fb:= (Frame + 1) / Frames;
       
   374 
       
   375 glBindTexture(GL_TEXTURE_2D, Texture^.id);
       
   376 
       
   377 glBegin(GL_QUADS);
       
   378 
       
   379 glTexCoord2f(0, ft);
       
   380 glVertex2i(-hw, -16);
       
   381 
       
   382 glTexCoord2f(1, ft);
       
   383 glVertex2i(hw, -16);
       
   384 
       
   385 glTexCoord2f(1, fb);
       
   386 glVertex2i(hw, 16);
       
   387 
       
   388 glTexCoord2f(0, fb);
       
   389 glVertex2i(-hw, 16);
       
   390 
       
   391 glEnd();
       
   392 
       
   393 glPopMatrix
       
   394 end;
       
   395 
   354 procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
   396 procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
   355 begin
   397 begin
   356 DrawRotatedTex(SpritesData[Sprite].Texture,
   398 DrawRotatedTex(SpritesData[Sprite].Texture,
   357 		SpritesData[Sprite].Width,
   399 		SpritesData[Sprite].Width,
   358 		SpritesData[Sprite].Height,
   400 		SpritesData[Sprite].Height,