From f4537c94794d456d4b7157efeeca2509363bdbb8 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 19 Feb 2008 14:02:17 +0000 Subject: mmmmmmmmmmmmm Looping background images in the menu's ... http://trac2.assembla.com/usdx/ticket/5#comment:2 ( starting to get there ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@865 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformWindows.pas | 2 +- Game/Code/Classes/UVideo.pas | 3 ++- Game/Code/Menu/UMenu.pas | 47 +++++++++++++++++++++++++++++----- Game/Code/Screens/UScreenMain.pas | 2 ++ Game/Code/Screens/UScreenName.pas | 2 ++ 5 files changed, 47 insertions(+), 9 deletions(-) diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas index ea2fe198..3d1713ee 100644 --- a/Game/Code/Classes/UPlatformWindows.pas +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -194,7 +194,7 @@ end; procedure TPlatformWindows.halt; begin - halt(0); // Application.terminate does NOT do the same thing.. + halt(); // Application.terminate does NOT do the same thing.. end; function TPlatformWindows.GetLogPath : WideString; diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 1eab5d91..b48f89c5 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -223,7 +223,8 @@ begin 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); {$endif} - if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then +// if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then + if (VideoTime <> 0) and flooptime = 0 then begin {$ifdef DebugFrames} // frame delay debug display diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 339402a2..6a5cb0ff 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -28,6 +28,8 @@ type BackImg: TTexture; BackW: integer; BackH: integer; + + fFileName : string; public Text: array of TText; Static: array of TStatic; @@ -181,6 +183,9 @@ begin //Set ButtonPos to Autoset Length ButtonPos := -1; + + + VideoPlayback.Init; end; { constructor TMenu.Create(Back: String); @@ -290,17 +295,23 @@ begin end; procedure TMenu.AddBackground(Name: string); -var - lFileName : string; +//var +// lFileName : string; begin if Name <> '' then begin - lFileName := Skin.GetTextureFileName(Name); - lFileName := AdaptFilePaths( lFileName ); + fFileName := Skin.GetTextureFileName(Name); + fFileName := AdaptFilePaths( fFileName ); - if fileexists( lFileName ) then + if fileexists( fFileName ) then begin - BackImg := Texture.GetTexture( lFileName , 'Plain'); + BackImg := Texture.GetTexture( fFileName , 'Plain'); + + if ( BackImg.TexNum = 0 ) then + begin + if VideoPlayback.Open( fFileName ) then + VideoPlayback.Play; + end; BackImg.W := 800; BackImg.H := 600; @@ -733,6 +744,7 @@ var PetX: integer; PetY: integer; begin + BackImg.ColR := 1; BackImg.ColG := 1; BackImg.ColB := 1; @@ -740,7 +752,8 @@ begin BackImg.TexY1 := 0; BackImg.TexX2 := 1; BackImg.TexY2 := 1; - if (BackImg.TexNum <> -1) then begin + if (BackImg.TexNum <> -1) then + begin // does anyone know what these loops were for? { // draw texture with overlapping for PetY := 1 to BackH do @@ -758,6 +771,14 @@ begin BackImg.H := 600; DrawTexture(BackImg); end; // if + + +// if assigned( VideoPlayback ) then + begin + VideoPlayback.GetFrame( now() ); + VideoPlayback.DrawGL(2); + end; + end; function TMenu.DrawFG: boolean; @@ -1513,6 +1534,18 @@ procedure TMenu.onShow; begin // nothing // beep; + + if fileexists( fFileName ) then + begin + // BackImg := Texture.GetTexture( fFileName , 'Plain'); + + if ( BackImg.TexNum = 0 ) then + begin + if VideoPlayback.Open( fFileName ) then + VideoPlayback.Play; + end; + end; + end; procedure TMenu.onShowFinish; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index cc2ccc80..167d63ef 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -222,6 +222,8 @@ end; procedure TScreenMain.onShow; begin + inherited; + LCD.WriteText(1, ' Choose mode: '); UpdateLCD; end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index f33d6409..079d33fb 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -210,6 +210,8 @@ procedure TScreenName.onShow; var I: integer; begin + inherited; + for I := 1 to 6 do Button[I-1].Text[0].Text := Ini.Name[I-1]; -- cgit v1.2.3