--- a/hedgewars/uWorld.pas Mon Jun 04 08:11:47 2012 -0400
+++ b/hedgewars/uWorld.pas Mon Jun 04 21:32:30 2012 +0400
@@ -60,7 +60,8 @@
uCaptions,
uCursor,
uCommands,
- uMobile
+ uMobile,
+ uVideoRec
;
var cWaveWidth, cWaveHeight: LongInt;
@@ -80,6 +81,7 @@
stereoDepth: GLfloat;
isFirstFrame: boolean;
AMAnimType: LongInt;
+ recTexture: PTexture;
const cStereo_Sky = 0.0500;
cStereo_Horizon = 0.0250;
@@ -381,6 +383,8 @@
timeTexture:= nil;
FreeTexture(missionTex);
missionTex:= nil;
+ FreeTexture(recTexture);
+ recTexture:= nil;
end;
function GetAmmoMenuTexture(Ammo: PHHAmmo): PTexture;
@@ -958,7 +962,7 @@
//glPushMatrix;
//glScalef(1.0, 1.0, 1.0);
- if not isPaused then
+ if (not isPaused) and (GameType <> gmtRecord) then
MoveCamera;
if cStereoMode = smNone then
@@ -989,7 +993,7 @@
DrawWorldStereo(0, rmRightEye);
// detatch drawing from fbs
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, defaultFrame);
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
SetScale(cDefaultZoomLevel);
@@ -1573,6 +1577,31 @@
end
end;
+// rec
+if flagPrerecording then
+ begin
+ if recTexture = nil then
+ begin
+ s:= 'rec';
+ tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fntBig].Handle, Str2PChar(s), cWhiteColorChannels);
+ tmpSurface:= doSurfaceConversion(tmpSurface);
+ FreeTexture(recTexture);
+ recTexture:= Surface2Tex(tmpSurface, false);
+ SDL_FreeSurface(tmpSurface)
+ end;
+ DrawTexture( -(cScreenWidth shr 1) + 50, 20, recTexture);
+
+ // draw red circle
+ glDisable(GL_TEXTURE_2D);
+ Tint($FF, $00, $00, Byte(Round(127*(1 + sin(SDL_GetTicks()*0.007)))));
+ glBegin(GL_POLYGON);
+ for i:= 0 to 20 do
+ glVertex2f(-(cScreenWidth shr 1) + 30 + sin(i*2*Pi/20)*10, 35 + cos(i*2*Pi/20)*10);
+ glEnd();
+ Tint($FF, $FF, $FF, $FF);
+ glEnable(GL_TEXTURE_2D);
+ end;
+
SetScale(zoom);
// Cursor
@@ -1752,8 +1781,12 @@
if (not cHasFocus) and (GameState <> gsConfirm) then
ParseCommand('quit', true);
-if not cHasFocus then DampenAudio()
-else UndampenAudio();
+// do not change volume during prerecording as it will affect sound in video file
+if not flagPrerecording then
+ begin
+ if not cHasFocus then DampenAudio()
+ else UndampenAudio();
+ end;
end;
procedure SetUtilityWidgetState(ammoType: TAmmoType);
@@ -1810,6 +1843,7 @@
procedure initModule;
begin
fpsTexture:= nil;
+ recTexture:= nil;
FollowGear:= nil;
WindBarWidth:= 0;
bShowAmmoMenu:= false;
@@ -1840,7 +1874,9 @@
FreeTexture(timeTexture);
timeTexture:= nil;
FreeTexture(missionTex);
- missionTex:= nil
+ missionTex:= nil;
+ FreeTexture(recTexture);
+ recTexture:= nil;
end;
end.