Skip to content

Commit

Permalink
Added support for background video during Song Selection. (5_backgrou…
Browse files Browse the repository at this point in the history
…nd.mp4)

Draws BPM label separately from background. Requires themes to update/add 5_BPM.png with recommended size of 160 x 38
Updated FDK to reference libbjxa project instead of dll
  • Loading branch information
fisyher committed Mar 7, 2021
1 parent 770978e commit 1d77008
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
63 changes: 52 additions & 11 deletions DTXMania/Code/Stage/05.SongSelection/CStageSongSelection.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
using DiscordRPC;
using System;
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Diagnostics;
using System.IO;
using FDK;
using DirectShowLib;
using DiscordRPC;

using SlimDXKey = SlimDX.DirectInput.Key;

namespace DTXMania
{
internal class CStageSongSelection : CStage
{
// プロパティ
// プロパティ

protected override RichPresence Presence => new CDTXRichPresence
{
State = "In Menu",
Details = "Selecting a song",
};
protected override RichPresence Presence => new CDTXRichPresence
{
State = "In Menu",
Details = "Selecting a song",
};

public int nScrollbarRelativeYCoordinate
public int nScrollbarRelativeYCoordinate
{
get
{
Expand Down Expand Up @@ -248,6 +249,8 @@ public override void OnManagedCreateResources()
this.txTopPanel = CDTXMania.tGenerateTexture( CSkin.Path( @"Graphics\5_header panel.png" ), false );
this.txBottomPanel = CDTXMania.tGenerateTexture( CSkin.Path( @"Graphics\5_footer panel.png" ), false );
this.prvFontSearchInputNotification = new CPrivateFastFont(new FontFamily(CDTXMania.ConfigIni.str選曲リストフォント), 14, FontStyle.Regular);
this.dsBackgroundVideo = CDTXMania.t失敗してもスキップ可能なDirectShowを生成する(CSkin.Path(@"Graphics\5_background.mp4"), CDTXMania.app.WindowHandle, true);
this.txBPMLabel = CDTXMania.tGenerateTexture(CSkin.Path(@"Graphics\5_BPM.png"), false);

base.OnManagedCreateResources();
}
Expand All @@ -257,10 +260,12 @@ public override void OnManagedReleaseResources()
if( !base.bNotActivated )
{
CDTXMania.t安全にDisposeする( ref this.r現在演奏中のスコアの背景動画 );
CDTXMania.t安全にDisposeする(ref this.dsBackgroundVideo);

CDTXMania.tReleaseTexture( ref this.txBackground);
CDTXMania.tReleaseTexture( ref this.txTopPanel);
CDTXMania.tReleaseTexture( ref this.txBottomPanel);
CDTXMania.tReleaseTexture(ref this.txBPMLabel);
//
CDTXMania.t安全にDisposeする(ref this.txSearchInputNotification);
CDTXMania.t安全にDisposeする(ref this.prvFontSearchInputNotification);
Expand Down Expand Up @@ -295,15 +300,47 @@ public override int OnUpdateAndDraw()

this.ct登場時アニメ用共通.tUpdate();

//Draw background video and image
if(this.dsBackgroundVideo != null)
{
this.dsBackgroundVideo.t再生開始();
this.dsBackgroundVideo.MediaSeeking.GetPositions(out this.lDshowPosition, out this.lStopPosition);
this.dsBackgroundVideo.bループ再生 = true;

if (this.lDshowPosition == this.lStopPosition)
{
this.dsBackgroundVideo.MediaSeeking.SetPositions(
DsLong.FromInt64((long)(0)),
AMSeekingSeekingFlags.AbsolutePositioning,
0,
AMSeekingSeekingFlags.NoPositioning);
}

this.dsBackgroundVideo.t現時点における最新のスナップイメージをTextureに転写する(this.txBackground);
}

if( this.txBackground != null )
this.txBackground.tDraw2D( CDTXMania.app.Device, 0, 0 );
{
if (this.dsBackgroundVideo != null && this.dsBackgroundVideo.b上下反転)
{
this.txBackground.tDraw2DUpsideDown(CDTXMania.app.Device, 0, 0);
}
else
{
this.txBackground.tDraw2D(CDTXMania.app.Device, 0, 0);
}
}

if (this.txBPMLabel != null)
this.txBPMLabel.tDraw2D(CDTXMania.app.Device, 32, 288);

this.actPreimagePanel.OnUpdateAndDraw();
// this.bIsEnumeratingSongs = !this.actPreimageパネル.bIsPlayingPremovie; // #27060 2011.3.2 yyagi: #PREMOVIE再生中は曲検索を中断する

this.actStatusPanel.OnUpdateAndDraw();
//this.actStatusPanel.OnUpdateAndDraw();
this.actArtistComment.OnUpdateAndDraw();
this.actSongList.OnUpdateAndDraw();
this.actStatusPanel.OnUpdateAndDraw();
this.actPerHistoryPanel.OnUpdateAndDraw();
int y = 0;
if( this.ct登場時アニメ用共通.b進行中 )
Expand Down Expand Up @@ -826,6 +863,10 @@ public CCounter this[ int index ]
private CTexture txBottomPanel; // tx下部パネル
private CTexture txTopPanel; // tx上部パネル
private CTexture txBackground; // tx背景
private CTexture txBPMLabel;
private CDirectShow dsBackgroundVideo; // background Video
private long lDshowPosition;
private long lStopPosition;

//
private Font ftSearchInputNotificationFont;
Expand Down
10 changes: 6 additions & 4 deletions FDK/FDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@
<HintPath>..\Runtime\dll\DirectShowLib-2005.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="libbjxa">
<HintPath>..\Libraries\libbjxa\obj\Debug\libbjxa.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SharpDX">
<HintPath>..\Runtime\dll\SharpDX.dll</HintPath>
<Private>False</Private>
Expand Down Expand Up @@ -184,6 +180,12 @@
<ItemGroup>
<Content Include="Code\01.Framework\Resources\sdx_icon_black.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Libraries\libbjxa\libbjxa.csproj">
<Project>{41e67409-f5ec-4216-a790-2519a7b22e51}</Project>
<Name>libbjxa</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild">
<!--Copy SourceFiles="$(TargetDir)$(TargetFileName)" DestinationFolder="$(SolutionDir)$(OutDir)dll" /-->
Expand Down

1 comment on commit 1d77008

@fisyher
Copy link
Collaborator Author

@fisyher fisyher commented on 1d77008 Mar 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes issue #78

Please sign in to comment.