# HG changeset patch # User unc0rr # Date 1201344934 0 # Node ID 8da05b316d813008fc58839f0b3f34e1587b8e7b # Parent bebfae2063b3167af7e3cb32378c0f2f42e5a528 Enable back fps counter diff -r bebfae2063b3 -r 8da05b316d81 QTfrontend/game.cpp --- a/QTfrontend/game.cpp Sat Jan 26 10:21:43 2008 +0000 +++ b/QTfrontend/game.cpp Sat Jan 26 10:55:34 2008 +0000 @@ -251,7 +251,7 @@ arguments << cfgdir->absolutePath(); arguments << QString::number(resolution.width()); arguments << QString::number(resolution.height()); - arguments << "16";//QString::number(config->bitDepth()); // bpp + arguments << QString::number(config->bitDepth()); // bpp arguments << QString("%1").arg(ipc_port); arguments << (config->vid_Fullscreen() ? "1" : "0"); arguments << (config->isSoundEnabled() ? "1" : "0"); diff -r bebfae2063b3 -r 8da05b316d81 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sat Jan 26 10:21:43 2008 +0000 +++ b/hedgewars/uConsts.pas Sat Jan 26 10:55:34 2008 +0000 @@ -111,7 +111,7 @@ MAXNAMELEN = 32; - COLOR_LAND = $7FFFFFF; + COLOR_LAND = $FFFFFFF; cifRandomize = $00000001; cifTheme = $00000002; diff -r bebfae2063b3 -r 8da05b316d81 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Sat Jan 26 10:21:43 2008 +0000 +++ b/hedgewars/uMisc.pas Sat Jan 26 10:55:34 2008 +0000 @@ -117,6 +117,7 @@ procedure SendStat(sit: TStatInfoType; s: shortstring); function Str2PChar(const s: shortstring): PChar; function Surface2Tex(surf: PSDL_Surface): PTexture; +procedure FreeTexture(tex: PTexture); var CursorPoint: TPoint; TargetPoint: TPoint = (X: NoPointX; Y: 0); @@ -286,6 +287,11 @@ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR) end; +procedure FreeTexture(tex: PTexture); +begin +glDeleteTextures(1, @tex^.id); +dispose(tex) +end; var i: LongInt; {$ENDIF} diff -r bebfae2063b3 -r 8da05b316d81 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Sat Jan 26 10:21:43 2008 +0000 +++ b/hedgewars/uStore.pas Sat Jan 26 10:55:34 2008 +0000 @@ -300,6 +300,7 @@ var rr: TSDL_Rect; t, b: real; begin +if SourceTexture^.h = 0 then exit; rr.x:= X; rr.y:= Y; rr.w:= r^.w; @@ -434,7 +435,7 @@ var ii: TSprite; begin for ii:= Low(TSprite) to High(TSprite) do - glDeleteTextures(1, @SpritesData[ii].Texture); + FreeTexture(SpritesData[ii].Texture); SDL_FreeSurface( HHSurface ); SDL_FreeSurface(LandSurface ) end; diff -r bebfae2063b3 -r 8da05b316d81 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Sat Jan 26 10:21:43 2008 +0000 +++ b/hedgewars/uWorld.pas Sat Jan 26 10:55:34 2008 +0000 @@ -52,7 +52,8 @@ var cWaterSprCount: LongInt; Captions: array[TCapGroup] of TCaptionStr; AMxLeft, AMxCurr, SlotsNum: LongInt; - fpsSurface: PSDL_Surface; + tmpSurface: PSDL_Surface; + fpsTexture: PTexture = nil; procedure InitWorld; begin @@ -361,12 +362,20 @@ Frames:= 0; CountTicks:= 0; s:= inttostr(FPS) + ' fps'; - if fpsSurface <> nil then SDL_FreeSurface(fpsSurface); - fpsSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), $FFFFFF); + if fpsTexture <> nil then FreeTexture(fpsTexture); + tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), $FFFFFF); + fpsTexture:= Surface2Tex(tmpSurface); + SDL_FreeSurface(tmpSurface) end; - r.x:= cScreenWidth - 50; - r.y:= 10; -// SDL_UpperBlit(fpsSurface, nil, Surface, @r) + if fpsTexture <> nil then + begin + r.x:= 0; + r.y:= 0; + r.w:= fpsTexture^.w; + r.h:= fpsTexture^.h; + DrawFromRect(cScreenWidth - 50, 10, @r, fpsTexture, Surface); + end +// SDL_UpperBlit(fpsSurface, nil, Surface, @r) end; inc(SoundTimerTicks, Lag);