Merge branch 'flamedevelop' into develop
This commit is contained in:
commit
0cd7518de6
77 files changed
+2008
-1983
No files matched your search
+3
-2
@@ -20,6 +20,7 @@ Output/Songs
|
||||
*.log
|
||||
/Output/Playlists/*.xml
|
||||
/Output/x64/gstreamer/GstreamerHelper.dll
|
||||
/Output/x86/gstreamer/GstreamerHelper.dll
|
||||
*.tlog
|
||||
*.suo
|
||||
*.obj
|
||||
@@ -35,6 +36,6 @@ Output/Songs
|
||||
*.nativecodeanalysis*
|
||||
*.lastcodeanalysissucceeded
|
||||
/PartyModes/*/*/*.dll
|
||||
|
||||
*.Cache
|
||||
/Output/x86/gstreamer/GstreamerHelper.dll
|
||||
/GstreamerHelper/bin/*
|
||||
/VocaluxeLib/bin
|
||||
@@ -39,14 +39,14 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWin|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWin|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -67,29 +67,35 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugWin|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>..\Output\x86\gstreamer\</OutDir>
|
||||
<LinkIncremental>
|
||||
</LinkIncremental>
|
||||
<OutDir>bin\$(Configuration).$(Platform)\</OutDir>
|
||||
<IncludePath>$(MSBuildProjectDirectory)\x86\lib\glib-2.0\include;$(MSBuildProjectDirectory)\x86\include\gstreamer-1.0;$(MSBuildProjectDirectory)\x86\include\glib-2.0;$(MSBuildProjectDirectory)\x86\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(MSBuildProjectDirectory)\x86\lib;$(LibraryPath)</LibraryPath>
|
||||
<GenerateManifest>true</GenerateManifest>
|
||||
<IntDir>obj\$(Configuration).$(Platform)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugWin|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>..\Output\x64\gstreamer\</OutDir>
|
||||
<OutDir>bin\$(Configuration).$(Platform)\</OutDir>
|
||||
<IncludePath>$(MSBuildProjectDirectory)\x64\lib\glib-2.0\include;$(MSBuildProjectDirectory)\x64\include\gstreamer-1.0;$(MSBuildProjectDirectory)\x64\include\glib-2.0;$(MSBuildProjectDirectory)\x64\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(MSBuildProjectDirectory)\x64\lib;$(LibraryPath)</LibraryPath>
|
||||
<CodeAnalysisRuleSet>..\CheckingRules.ruleset</CodeAnalysisRuleSet>
|
||||
<IntDir>obj\$(Configuration).$(Platform)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWin|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>..\Output\x86\gstreamer\</OutDir>
|
||||
<OutDir>bin\$(Configuration).$(Platform)\</OutDir>
|
||||
<IncludePath>$(MSBuildProjectDirectory)\x86\lib\glib-2.0\include;$(MSBuildProjectDirectory)\x86\include\gstreamer-1.0;$(MSBuildProjectDirectory)\x86\include\glib-2.0;$(MSBuildProjectDirectory)\x86\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(MSBuildProjectDirectory)\x86\lib;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>obj\$(Configuration).$(Platform)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWin|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>..\Output\x64\gstreamer\</OutDir>
|
||||
<OutDir>bin\$(Configuration).$(Platform)\</OutDir>
|
||||
<IncludePath>$(MSBuildProjectDirectory)\x64\lib\glib-2.0\include;$(MSBuildProjectDirectory)\x64\include\gstreamer-1.0;$(MSBuildProjectDirectory)\x64\include\glib-2.0;$(MSBuildProjectDirectory)\x64\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(MSBuildProjectDirectory)\x64\lib;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>obj\$(Configuration).$(Platform)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>..\Output\x86</OutDir>
|
||||
@@ -111,6 +117,12 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>gstreamer-1.0.lib;gstcontroller-1.0.lib;gobject-2.0.lib;glib-2.0.lib;gstapp-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(OutDir)*.dll" "$(SolutionDir)Output\x86\gstreamer\" /I /Y</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copying binary</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugWin|x64'">
|
||||
<ClCompile>
|
||||
@@ -125,6 +137,9 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>gstreamer-1.0.lib;gstcontroller-1.0.lib;gobject-2.0.lib;glib-2.0.lib;gstapp-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(OutDir)*.dll" "$(SolutionDir)Output\x64\gstreamer\" /I /Y</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWin|Win32'">
|
||||
<ClCompile>
|
||||
@@ -138,12 +153,18 @@
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>gstreamer-1.0.lib;gstcontroller-1.0.lib;gobject-2.0.lib;glib-2.0.lib;gstapp-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(OutDir)*.dll" "$(SolutionDir)Output\x86\gstreamer\" /I /Y</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copying binary</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWin|x64'">
|
||||
<ClCompile>
|
||||
@@ -159,11 +180,14 @@
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>gstreamer-1.0.lib;gstcontroller-1.0.lib;gobject-2.0.lib;glib-2.0.lib;gstapp-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(OutDir)*.dll" "$(SolutionDir)Output\x64\gstreamer\" /I /Y</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="GstreamerAudio.h" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<ScreenOptionsLyrics>
|
||||
<ScreenVersion>1</ScreenVersion>
|
||||
<ScreenVersion>2</ScreenVersion>
|
||||
<Background1>
|
||||
<!--<Type>: Background type: None, Color, Texture, Video-->
|
||||
<Type>Video</Type>
|
||||
@@ -111,7 +111,7 @@
|
||||
<!--<Font>: Text font name-->
|
||||
<Font>Outline</Font>
|
||||
<!--<Text>: Nothing or translation tag-->
|
||||
<Text>TR_SCREENOLYRICS_ONTOP</Text>
|
||||
<Text>TR_SCREENOLYRICS_POSITION</Text>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
@@ -240,7 +240,7 @@
|
||||
<!--<NumVisible>: Number of visible elements in the slide-->
|
||||
<NumVisible>4</NumVisible>
|
||||
</SelectSlideLyricStyle>
|
||||
<SelectSlideLyricsOnTop>
|
||||
<SelectSlideLyricsPosition>
|
||||
<!--<Skin>: Texture name-->
|
||||
<Skin>Invisible</Skin>
|
||||
<!--<SkinArrowLeft>: Texture name of left arrow-->
|
||||
@@ -306,6 +306,6 @@
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<!--<NumVisible>: Number of visible elements in the slide-->
|
||||
<NumVisible>2</NumVisible>
|
||||
</SelectSlideLyricsOnTop>
|
||||
</SelectSlideLyricsPosition>
|
||||
</ScreenOptionsLyrics>
|
||||
</root>
|
||||
</root>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<ScreenOptionsRecord>
|
||||
<ScreenVersion>2</ScreenVersion>
|
||||
<ScreenVersion>3</ScreenVersion>
|
||||
<Background1>
|
||||
<!--<Type>: Background type: None, Color, Texture, Video-->
|
||||
<Type>Video</Type>
|
||||
@@ -216,35 +216,6 @@
|
||||
<!-- <Height>: Reflection Height-->
|
||||
</Text2>
|
||||
<Text3>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>75</X>
|
||||
<Y>165</Y>
|
||||
<!--<Z>: Text position-->
|
||||
<Z>0,00</Z>
|
||||
<!--<H>: Text height-->
|
||||
<H>32</H>
|
||||
<!--<MaxW>: Maximum text width (if exists)-->
|
||||
<!--<Color>: Text color from ColorScheme (high priority)-->
|
||||
<!--or <R>, <G>, <B>, <A> (lower priority)-->
|
||||
<Color>StaticColor</Color>
|
||||
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
|
||||
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
|
||||
<SColor>TextSColor</SColor>
|
||||
<!--<Align>: Text align horizontal: Left, Center, Right-->
|
||||
<Align>Left</Align>
|
||||
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
|
||||
<HAlign>Center</HAlign>
|
||||
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
|
||||
<Style>Bold</Style>
|
||||
<!--<Font>: Text font name-->
|
||||
<Font>Outline</Font>
|
||||
<!--<Text>: Nothing or translation tag-->
|
||||
<Text>TR_SCREENORECORD_INPUT</Text>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
</Text3>
|
||||
<Text4>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>75</X>
|
||||
<Y>225</Y>
|
||||
@@ -272,8 +243,8 @@
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
</Text4>
|
||||
<Text5>
|
||||
</Text3>
|
||||
<Text4>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>75</X>
|
||||
<Y>285</Y>
|
||||
@@ -301,8 +272,8 @@
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
</Text5>
|
||||
<Text6>
|
||||
</Text4>
|
||||
<Text5>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>75</X>
|
||||
<Y>345</Y>
|
||||
@@ -330,7 +301,7 @@
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
</Text6>
|
||||
</Text5>
|
||||
<TextWarning>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>640</X>
|
||||
@@ -600,73 +571,6 @@
|
||||
<!--<NumVisible>: Number of visible elements in the slide-->
|
||||
<NumVisible>1</NumVisible>
|
||||
</SelectSlideRecordDevices>
|
||||
<SelectSlideRecordInputs>
|
||||
<!--<Skin>: Texture name-->
|
||||
<Skin>Invisible</Skin>
|
||||
<!--<SkinArrowLeft>: Texture name of left arrow-->
|
||||
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
|
||||
<!--<SkinArrowRight>: Texture name of right arrow-->
|
||||
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
|
||||
<!--<SkinSelected>: Texture name for selected SelectSlide-->
|
||||
<SkinSelected>SelectSlide</SkinSelected>
|
||||
<!--<SkinArrowLeftSelected>: Texture name of selected left arrow-->
|
||||
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
|
||||
<!--<SkinArrowRightSelected>: Texture name of selected right arrow-->
|
||||
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
|
||||
<!--<SkinHighlighted>: Texture name for highlighted SelectSlide-->
|
||||
<SkinHighlighted>SelectSlide</SkinHighlighted>
|
||||
<!--<X>, <Y>, <Z>, <W>, <H>: SelectSlide position, width and height-->
|
||||
<X>500</X>
|
||||
<Y>160</Y>
|
||||
<Z>0,00</Z>
|
||||
<W>700</W>
|
||||
<H>50</H>
|
||||
<!--<ArrowLeftX>, <ArrowLeftY>, <ArrowLeftZ>, <ArrowLeftW>, <ArrowLeftH>: Left arrow position, width and height-->
|
||||
<ArrowLeftX>505</ArrowLeftX>
|
||||
<ArrowLeftY>165</ArrowLeftY>
|
||||
<ArrowLeftZ>0,00</ArrowLeftZ>
|
||||
<ArrowLeftW>40</ArrowLeftW>
|
||||
<ArrowLeftH>40</ArrowLeftH>
|
||||
<!--<ArrowRightX>, <ArrowRightY>, <ArrowRightZ>, <ArrowRightW>, <ArrowRightH>: Right arrow position, width and height-->
|
||||
<ArrowRightX>1170</ArrowRightX>
|
||||
<ArrowRightY>165</ArrowRightY>
|
||||
<ArrowRightZ>0,00</ArrowRightZ>
|
||||
<ArrowRightW>40</ArrowRightW>
|
||||
<ArrowRightH>40</ArrowRightH>
|
||||
<!--<Color>: SelectSlide color from ColorScheme (high priority)-->
|
||||
<!--or <R>, <G>, <B>, <A> (lower priority)-->
|
||||
<Color>SelectSlideColor</Color>
|
||||
<!--<SColor>: Selected SelectSlide color from ColorScheme (high priority)-->
|
||||
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
|
||||
<SColor>SelectSlideSColor</SColor>
|
||||
<!--<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)-->
|
||||
<!--or <HR>, <HG>, <HB>, <HA> (lower priority)-->
|
||||
<HColor>SelectSlideHColor</HColor>
|
||||
<!--<ArrowColor>: Arrow color from ColorScheme (high priority)-->
|
||||
<!--or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)-->
|
||||
<ArrowColor>ArrowColor</ArrowColor>
|
||||
<!--<ArrowSColor>: Selected arrow color from ColorScheme (high priority)-->
|
||||
<!--or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower priority)-->
|
||||
<ArrowSColor>ArrowSColor</ArrowSColor>
|
||||
<!--<TextColor>: Text color from ColorScheme (high priority)-->
|
||||
<!--or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)-->
|
||||
<TextColor>TextColor</TextColor>
|
||||
<!--<TextSColor>: Selected text color from ColorScheme (high priority)-->
|
||||
<!--or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)-->
|
||||
<TextSColor>TextSColor</TextSColor>
|
||||
<!--<TextH>: Text height-->
|
||||
<TextH>32,00</TextH>
|
||||
<!--<TextRelativeX>: Text relative x-position-->
|
||||
<!--<TextRelativeY>: Text relative y-position-->
|
||||
<!--<TextMaxW>: Maximum text width (if exists)-->
|
||||
<TextMaxW>616,00</TextMaxW>
|
||||
<!--<TextFont>: Text font name-->
|
||||
<TextFont>Outline</TextFont>
|
||||
<!--<TextStyle>: Text style: Normal, Italic, Bold, BoldItalic-->
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<!--<NumVisible>: Number of visible elements in the slide-->
|
||||
<NumVisible>1</NumVisible>
|
||||
</SelectSlideRecordInputs>
|
||||
<SelectSlideRecordChannel1>
|
||||
<!--<Skin>: Texture name-->
|
||||
<Skin>Invisible</Skin>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
ScreenOptionsSound
|
||||
|
||||
++++++++++
|
||||
Version 2:
|
||||
Rename <SelectSlideLyricsOnTop> to <SelectSlideLyricsPosition>
|
||||
++++++++++
|
||||
Version 1:
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_Screens.TryGetValue("CPartyScreenChallengeMain", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
CBase.Songs.ResetPartySongSung();
|
||||
CBase.Songs.ResetSongSung();
|
||||
_ToScreenMain.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce);
|
||||
@@ -459,11 +459,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
CBase.Game.AddSong(songID, gm);
|
||||
CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
|
||||
|
||||
SPlayer[] player = CBase.Game.GetPlayers();
|
||||
if (player == null)
|
||||
SPlayer[] players = CBase.Game.GetPlayers();
|
||||
if (players == null)
|
||||
return;
|
||||
|
||||
if (player.Length < _GameData.NumPlayerAtOnce)
|
||||
if (players.Length < _GameData.NumPlayerAtOnce)
|
||||
return;
|
||||
|
||||
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
|
||||
@@ -472,9 +472,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
//try to fill with the right data
|
||||
if (c != null)
|
||||
player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
|
||||
players[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
|
||||
else
|
||||
player[i].ProfileID = -1;
|
||||
players[i].ProfileID = -1;
|
||||
}
|
||||
|
||||
CBase.Songs.AddPartySongSung(songID);
|
||||
|
||||
@@ -504,7 +504,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
|
||||
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
|
||||
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
_RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
|
||||
else
|
||||
_RoundsTable[i].TextScores[p].Text = "";
|
||||
|
||||
@@ -130,7 +130,8 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>cd $(SolutionDir)Partymodes\
|
||||
<PostBuildEvent>if exist "$(SolutionDir)Output\PartyModes\$(TargetName)\Code" rd "$(SolutionDir)Output\PartyModes\$(TargetName)\Code" /S /Q
|
||||
cd $(SolutionDir)Partymodes\
|
||||
xcopy "$(ProjectDir)*.cs" "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\" /EXCLUDE:Excludes.txt /I /Y</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
@@ -187,14 +188,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
_Stage = EStage.NotStarted;
|
||||
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
|
||||
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = EOffOn.TR_CONFIG_OFF;
|
||||
_ScreenSongOptions.Sorting.SongSorting = ESongSorting.TR_CONFIG_NONE;
|
||||
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
|
||||
_ScreenSongOptions.Selection.SongIndex = -1;
|
||||
|
||||
if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
|
||||
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
|
||||
|
||||
_ToScreenMain.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.ResultTable = new List<CResultTableRow>();
|
||||
|
||||
@@ -313,7 +311,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_Screens.TryGetValue("CPartyScreenChallengeMedleyMain", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
CBase.Songs.ResetPartySongSung();
|
||||
CBase.Songs.ResetSongSung();
|
||||
_ToScreenMain.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce);
|
||||
@@ -482,11 +480,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
#region PlayerNames
|
||||
CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
|
||||
SPlayer[] player = CBase.Game.GetPlayers();
|
||||
if (player == null)
|
||||
SPlayer[] players = CBase.Game.GetPlayers();
|
||||
if (players == null)
|
||||
return false;
|
||||
|
||||
if (player.Length < _GameData.NumPlayerAtOnce)
|
||||
if (players.Length < _GameData.NumPlayerAtOnce)
|
||||
return false;
|
||||
|
||||
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
|
||||
@@ -495,33 +493,32 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
//try to fill with the right data
|
||||
if (c != null)
|
||||
player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
|
||||
players[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
|
||||
else
|
||||
player[i].ProfileID = -1;
|
||||
players[i].ProfileID = -1;
|
||||
}
|
||||
#endregion PlayerNames
|
||||
|
||||
#region SongQueque
|
||||
if (CBase.Songs.GetNumVisibleSongs() < _NumSongs)
|
||||
CBase.Songs.ResetPartySongSung();
|
||||
#region SongQueue
|
||||
if (CBase.Songs.GetNumSongsVisible() < _NumSongs)
|
||||
CBase.Songs.ResetSongSung();
|
||||
|
||||
const EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY;
|
||||
List<int> ids = new List<int>();
|
||||
|
||||
CSong[] visSongs = CBase.Songs.GetSongsNotSung();
|
||||
if (visSongs == null)
|
||||
ReadOnlyCollection<CSong> visibleSongs = CBase.Songs.GetVisibleSongs();
|
||||
if (visibleSongs.Count == 0)
|
||||
{
|
||||
CBase.Log.LogError("CPartyChallengeMedleyMode Error: There are no songs!");
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenParty);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < visSongs.Length; i++)
|
||||
foreach (CSong song in visibleSongs)
|
||||
{
|
||||
foreach (EGameMode mode in visSongs[i].AvailableGameModes)
|
||||
foreach (EGameMode mode in song.AvailableGameModes)
|
||||
{
|
||||
if (mode == EGameMode.TR_GAMEMODE_MEDLEY)
|
||||
ids.Add(visSongs[i].ID);
|
||||
ids.Add(song.ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,13 +533,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
while (s < _NumSongs && ids.Count > 0)
|
||||
{
|
||||
int songID = ids[CBase.Game.GetRandom(ids.Count)];
|
||||
CBase.Game.AddSong(songID, gm);
|
||||
CBase.Game.AddSong(songID, EGameMode.TR_GAMEMODE_MEDLEY);
|
||||
CBase.Songs.AddPartySongSung(songID);
|
||||
ids.Remove(songID);
|
||||
s++;
|
||||
}
|
||||
return true;
|
||||
#endregion SongQueque
|
||||
#endregion SongQueue
|
||||
}
|
||||
|
||||
private void _SetNumJokers()
|
||||
|
||||
@@ -504,7 +504,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
|
||||
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
|
||||
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
_RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
|
||||
else
|
||||
_RoundsTable[i].TextScores[p].Text = "";
|
||||
|
||||
@@ -130,7 +130,8 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>cd $(SolutionDir)Partymodes\
|
||||
<PostBuildEvent>if exist "$(SolutionDir)Output\PartyModes\$(TargetName)\Code" rd "$(SolutionDir)Output\PartyModes\$(TargetName)\Code" /S /Q
|
||||
cd $(SolutionDir)Partymodes\
|
||||
xcopy "$(ProjectDir)*.cs" "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\" /EXCLUDE:Excludes.txt /I /Y</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -374,7 +374,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (screen != null)
|
||||
{
|
||||
_GameData.Team = _GameData.Team == 1 ? 0 : 1;
|
||||
CBase.Songs.ResetPartySongSung();
|
||||
CBase.Songs.ResetSongSung();
|
||||
_GameData.CurrentRoundNr = 1;
|
||||
_ToScreenMain.CurrentRoundNr = 1;
|
||||
_ToScreenMain.NumFields = _GameData.NumFields;
|
||||
@@ -718,11 +718,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
CBase.Game.SetNumPlayer(2);
|
||||
|
||||
SPlayer[] player = CBase.Game.GetPlayers();
|
||||
if (player == null)
|
||||
SPlayer[] players = CBase.Game.GetPlayers();
|
||||
if (players == null)
|
||||
return;
|
||||
|
||||
if (player.Length < 2)
|
||||
if (players.Length < 2)
|
||||
return;
|
||||
|
||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
@@ -732,7 +732,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
//default values
|
||||
player[i].ProfileID = -1;
|
||||
players[i].ProfileID = -1;
|
||||
}
|
||||
|
||||
//try to fill with the right data
|
||||
@@ -740,15 +740,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
if (_GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length)
|
||||
{
|
||||
player[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
|
||||
players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
|
||||
if (isDuet)
|
||||
player[0].LineNr = 0;
|
||||
players[0].LineNr = 0;
|
||||
}
|
||||
if (_GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length)
|
||||
{
|
||||
player[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
|
||||
players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
|
||||
if (isDuet)
|
||||
player[1].LineNr = 1;
|
||||
players[1].LineNr = 1;
|
||||
}
|
||||
SongSelected(r.SongID);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,8 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>cd $(SolutionDir)Partymodes\
|
||||
<PostBuildEvent>if exist "$(SolutionDir)Output\PartyModes\$(TargetName)\Code" rd "$(SolutionDir)Output\PartyModes\$(TargetName)\Code" /S /Q
|
||||
cd $(SolutionDir)Partymodes\
|
||||
xcopy "$(ProjectDir)*.cs" "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\" /EXCLUDE:Excludes.txt /I /Y</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SpecifyACultureInStringConversionExplicitly/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEverywhere/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Cleanup/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Cleanup"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSShortenReferences>True</CSShortenReferences><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpaLine truncated
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Simple_0020Reformat/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Simple Reformat"><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Ordering><AlphabeticalUsingDirectives>Ignore</AlphabeticalUsingDirectives><ExpandUsingDirectiLine truncated
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Cleanup/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Cleanup"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSShortenReferences>True</CSShortenReferences><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpaLine truncated
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Simple_0020Reformat/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Simple Reformat"><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Ordering><AlphabeticalUsingDirectives>Ignore</AlphabeticalUsingDirectives><ExpandUsingDirectiLine truncated
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Cleanup</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Simple Reformat</s:String>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_FIELD/@EntryValue">0</s:Int64>
|
||||
@@ -25,6 +25,7 @@
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_COMPLEX_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
|
||||
@@ -36,7 +37,9 @@
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">180</s:Int64>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_MULTIPLE_DECLARATION_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_TERNARY_EXPR_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AddImportsToDeepestScope/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AllowAlias/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/QualifiedUsingAtNestedScope/@EntryValue">False</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderRegionName/@EntryValue">license</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">/*
|
||||
This file is part of $SOLUTION$.
|
||||
|
||||
+39
-73
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -52,7 +53,6 @@ namespace Vocaluxe.Base
|
||||
public static int ScreenH = 576;
|
||||
|
||||
public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0;
|
||||
public static EColorDepth ColorDepth = EColorDepth.Bit32;
|
||||
|
||||
public static EOffOn VSync = EOffOn.TR_CONFIG_ON;
|
||||
public static EOffOn FullScreen = EOffOn.TR_CONFIG_ON;
|
||||
@@ -94,7 +94,7 @@ namespace Vocaluxe.Base
|
||||
public static int NumPlayer = 2;
|
||||
public static EOffOn Tabs = EOffOn.TR_CONFIG_OFF;
|
||||
public static string Language = "English";
|
||||
public static EOffOn LyricsOnTop = EOffOn.TR_CONFIG_OFF;
|
||||
public static ELyricsPosition LyricsPosition = ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM;
|
||||
public static readonly string[] Players = new string[CSettings.MaxNumPlayer];
|
||||
|
||||
public static float MinLineBreakTime = 0.1f; //Minimum time to show the text before it is (to be) sung (if possible)
|
||||
@@ -166,7 +166,6 @@ namespace Vocaluxe.Base
|
||||
xmlReader.TryGetIntValue("//root/Graphics/ScreenW", ref ScreenW);
|
||||
xmlReader.TryGetIntValue("//root/Graphics/ScreenH", ref ScreenH);
|
||||
xmlReader.TryGetEnumValue("//root/Graphics/AAMode", ref AAMode);
|
||||
xmlReader.TryGetEnumValue("//root/Graphics/Colors", ref ColorDepth);
|
||||
xmlReader.TryGetFloatValue("//root/Graphics/MaxFPS", ref MaxFPS);
|
||||
xmlReader.TryGetEnumValue("//root/Graphics/VSync", ref VSync);
|
||||
xmlReader.TryGetEnumValue("//root/Graphics/FullScreen", ref FullScreen);
|
||||
@@ -223,7 +222,7 @@ namespace Vocaluxe.Base
|
||||
xmlReader.TryGetIntValue("//root/Game/NumPlayer", ref NumPlayer);
|
||||
xmlReader.TryGetEnumValue("//root/Game/Tabs", ref Tabs);
|
||||
xmlReader.GetValue("//root/Game/Language", out Language, Language);
|
||||
xmlReader.TryGetEnumValue("//root/Game/LyricsOnTop", ref LyricsOnTop);
|
||||
xmlReader.TryGetEnumValue("//root/Game/LyricsPosition", ref LyricsPosition);
|
||||
xmlReader.TryGetFloatValue("//root/Game/MinLineBreakTime", ref MinLineBreakTime);
|
||||
|
||||
if ((ScoreAnimationTime > 0 && ScoreAnimationTime < 1) || ScoreAnimationTime < 0)
|
||||
@@ -268,7 +267,6 @@ namespace Vocaluxe.Base
|
||||
MicConfig[p - 1] = new SMicConfig(0);
|
||||
xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceName", out MicConfig[p - 1].DeviceName, String.Empty);
|
||||
xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceDriver", out MicConfig[p - 1].DeviceDriver, String.Empty);
|
||||
xmlReader.GetValue("//root/Record/MicConfig" + p + "/InputName", out MicConfig[p - 1].InputName, String.Empty);
|
||||
xmlReader.TryGetIntValue("//root/Record/MicConfig" + p + "/Channel", ref MicConfig[p - 1].Channel);
|
||||
}
|
||||
|
||||
@@ -330,9 +328,6 @@ namespace Vocaluxe.Base
|
||||
writer.WriteComment("AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes))));
|
||||
writer.WriteElementString("AAMode", Enum.GetName(typeof(EAntiAliasingModes), AAMode));
|
||||
|
||||
writer.WriteComment("Colors: " + CHelper.ListStrings(Enum.GetNames(typeof(EColorDepth))));
|
||||
writer.WriteElementString("Colors", Enum.GetName(typeof(EColorDepth), ColorDepth));
|
||||
|
||||
writer.WriteComment("MaxFPS should be between 1..200");
|
||||
writer.WriteElementString("MaxFPS", MaxFPS.ToString("#"));
|
||||
|
||||
@@ -466,8 +461,8 @@ namespace Vocaluxe.Base
|
||||
writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
|
||||
writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs));
|
||||
|
||||
writer.WriteComment("Lyrics also on Top of screen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
|
||||
writer.WriteElementString("LyricsOnTop", Enum.GetName(typeof(EOffOn), LyricsOnTop));
|
||||
writer.WriteComment("Position if lyrics on screen: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricsPosition))));
|
||||
writer.WriteElementString("LyricsPosition", Enum.GetName(typeof(ELyricsPosition), LyricsPosition));
|
||||
|
||||
writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung");
|
||||
writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString());
|
||||
@@ -519,13 +514,12 @@ namespace Vocaluxe.Base
|
||||
|
||||
for (int p = 1; p <= CSettings.MaxNumPlayer; p++)
|
||||
{
|
||||
if (MicConfig[p - 1].DeviceName != "" && MicConfig[p - 1].InputName != "" && MicConfig[p - 1].Channel > 0)
|
||||
if (MicConfig[p - 1].DeviceName != "" && MicConfig[p - 1].Channel > 0)
|
||||
{
|
||||
writer.WriteStartElement("MicConfig" + p);
|
||||
|
||||
writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName);
|
||||
writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver);
|
||||
writer.WriteElementString("InputName", MicConfig[p - 1].InputName);
|
||||
writer.WriteElementString("Channel", MicConfig[p - 1].Channel.ToString());
|
||||
|
||||
writer.WriteEndElement();
|
||||
@@ -568,19 +562,11 @@ namespace Vocaluxe.Base
|
||||
/// <returns></returns>
|
||||
public static bool IsMicConfig()
|
||||
{
|
||||
SRecordDevice[] devices = CSound.RecordGetDevices();
|
||||
ReadOnlyCollection<CRecordDevice> devices = CSound.RecordGetDevices();
|
||||
if (devices == null)
|
||||
return false;
|
||||
|
||||
for (int dev = 0; dev < devices.Length; dev++)
|
||||
{
|
||||
for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
|
||||
{
|
||||
if (devices[dev].Inputs[inp].PlayerChannel1 != 0 || devices[dev].Inputs[inp].PlayerChannel2 != 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return devices.Any(t => t.PlayerChannel1 != 0 || t.PlayerChannel2 != 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -590,19 +576,11 @@ namespace Vocaluxe.Base
|
||||
/// <returns></returns>
|
||||
public static bool IsMicConfig(int player)
|
||||
{
|
||||
SRecordDevice[] devices = CSound.RecordGetDevices();
|
||||
ReadOnlyCollection<CRecordDevice> devices = CSound.RecordGetDevices();
|
||||
if (devices == null)
|
||||
return false;
|
||||
|
||||
for (int dev = 0; dev < devices.Length; dev++)
|
||||
{
|
||||
for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
|
||||
{
|
||||
if (devices[dev].Inputs[inp].PlayerChannel1 == player || devices[dev].Inputs[inp].PlayerChannel2 == player)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return devices.Any(t => t.PlayerChannel1 == player || t.PlayerChannel2 == player);
|
||||
}
|
||||
|
||||
public static int GetMaxNumMics()
|
||||
@@ -625,65 +603,53 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
//Look for (usb-)mic
|
||||
//SRecordDevice[] Devices = new SRecordDevice[CSound.RecordGetDevices().Length];
|
||||
SRecordDevice[] devices = CSound.RecordGetDevices();
|
||||
ReadOnlyCollection<CRecordDevice> devices = CSound.RecordGetDevices();
|
||||
if (devices == null)
|
||||
return false;
|
||||
|
||||
for (int dev = 0; dev < devices.Length; dev++)
|
||||
foreach (CRecordDevice device in devices)
|
||||
{
|
||||
//Has Device some signal-names in name -> This could be a (usb-)mic
|
||||
if (Regex.IsMatch(devices[dev].Name, "Usb|Wireless", RegexOptions.IgnoreCase))
|
||||
if (Regex.IsMatch(device.Name, "Usb|Wireless", RegexOptions.IgnoreCase))
|
||||
{
|
||||
//Check if there are inputs.
|
||||
if (devices[dev].Inputs.Count >= 1)
|
||||
//Check if there is one or more channels
|
||||
if (device.Channels >= 2)
|
||||
{
|
||||
//Check if there is one or more channels
|
||||
if (devices[dev].Inputs[0].Channels >= 2)
|
||||
{
|
||||
//Set this device to player 1
|
||||
MicConfig[0].DeviceName = devices[dev].Name;
|
||||
MicConfig[0].DeviceDriver = devices[dev].Driver;
|
||||
MicConfig[0].InputName = devices[dev].Inputs[0].Name;
|
||||
MicConfig[0].Channel = 1;
|
||||
//Set this device to player 2
|
||||
MicConfig[1].DeviceName = devices[dev].Name;
|
||||
MicConfig[1].DeviceDriver = devices[dev].Driver;
|
||||
MicConfig[1].InputName = devices[dev].Inputs[0].Name;
|
||||
MicConfig[1].Channel = 2;
|
||||
//Set this device to player 1
|
||||
MicConfig[0].DeviceName = device.Name;
|
||||
MicConfig[0].DeviceDriver = device.Driver;
|
||||
MicConfig[0].Channel = 1;
|
||||
//Set this device to player 2
|
||||
MicConfig[1].DeviceName = device.Name;
|
||||
MicConfig[1].DeviceDriver = device.Driver;
|
||||
MicConfig[1].Channel = 2;
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//If no usb-mics found -> Look for Devices with "mic" or "mik"
|
||||
for (int dev = 0; dev < devices.Length; dev++)
|
||||
foreach (CRecordDevice device in devices)
|
||||
{
|
||||
//Has Device some signal-names in name -> This could be a mic
|
||||
if (Regex.IsMatch(devices[dev].Name, "Mic|Mik", RegexOptions.IgnoreCase))
|
||||
if (Regex.IsMatch(device.Name, "Mic|Mik", RegexOptions.IgnoreCase))
|
||||
{
|
||||
//Check if there are inputs.
|
||||
if (devices[dev].Inputs.Count >= 1)
|
||||
//Check if there is one or more channels
|
||||
if (device.Channels >= 1)
|
||||
{
|
||||
//Check if there is one or more channels
|
||||
if (devices[dev].Inputs[0].Channels >= 1)
|
||||
//Set this device to player 1
|
||||
MicConfig[0].DeviceName = device.Name;
|
||||
MicConfig[0].DeviceDriver = device.Driver;
|
||||
MicConfig[0].Channel = 1;
|
||||
|
||||
if (device.Channels >= 2)
|
||||
{
|
||||
//Set this device to player 1
|
||||
MicConfig[0].DeviceName = devices[dev].Name;
|
||||
MicConfig[0].DeviceDriver = devices[dev].Driver;
|
||||
MicConfig[0].InputName = devices[dev].Inputs[0].Name;
|
||||
MicConfig[0].Channel = 1;
|
||||
//Set this device to player 2
|
||||
MicConfig[1].DeviceName = device.Name;
|
||||
MicConfig[1].DeviceDriver = device.Driver;
|
||||
MicConfig[1].Channel = 2;
|
||||
|
||||
if (devices[dev].Inputs[0].Channels >= 2)
|
||||
{
|
||||
//Set this device to player 2
|
||||
MicConfig[1].DeviceName = devices[dev].Name;
|
||||
MicConfig[1].DeviceDriver = devices[dev].Driver;
|
||||
MicConfig[1].InputName = devices[dev].Inputs[0].Name;
|
||||
MicConfig[1].Channel = 2;
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,56 +23,56 @@ using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
{
|
||||
static class CInput
|
||||
static class CController
|
||||
{
|
||||
private static IInput _Input;
|
||||
private static IController _Controller;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_Input = new CWiiMote();
|
||||
_Controller = new CWiiMote();
|
||||
|
||||
_Input.Init();
|
||||
_Controller.Init();
|
||||
}
|
||||
|
||||
public static void Close()
|
||||
{
|
||||
_Input.Close();
|
||||
_Input = null;
|
||||
_Controller.Close();
|
||||
_Controller = null;
|
||||
}
|
||||
|
||||
public static void Connect()
|
||||
{
|
||||
_Input.Connect();
|
||||
_Controller.Connect();
|
||||
}
|
||||
|
||||
public static void Disconnect()
|
||||
{
|
||||
_Input.Disconnect();
|
||||
_Controller.Disconnect();
|
||||
}
|
||||
|
||||
public static bool IsConnected()
|
||||
{
|
||||
return _Input.IsConnected();
|
||||
return _Controller.IsConnected();
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
_Input.Update();
|
||||
_Controller.Update();
|
||||
}
|
||||
|
||||
public static bool PollKeyEvent(ref SKeyEvent keyEvent)
|
||||
{
|
||||
return _Input.PollKeyEvent(ref keyEvent);
|
||||
return _Controller.PollKeyEvent(ref keyEvent);
|
||||
}
|
||||
|
||||
public static bool PollMouseEvent(ref SMouseEvent mouseEvent)
|
||||
{
|
||||
return _Input.PollMouseEvent(ref mouseEvent);
|
||||
return _Controller.PollMouseEvent(ref mouseEvent);
|
||||
}
|
||||
|
||||
public static void SetRumble(float duration)
|
||||
{
|
||||
_Input.SetRumble(duration);
|
||||
_Controller.SetRumble(duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -708,17 +708,9 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
//This is a USDX 1.01 DB
|
||||
if (!dateExists)
|
||||
{
|
||||
command.CommandText =
|
||||
"INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores";
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is a CMD 1.01 DB
|
||||
command.CommandText =
|
||||
"INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
|
||||
}
|
||||
command.CommandText = !dateExists
|
||||
? "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores"
|
||||
: "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs";
|
||||
@@ -763,7 +755,9 @@ namespace Vocaluxe.Base
|
||||
|
||||
stmt = new Sqlite3.Vdbe();
|
||||
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (!dateExists)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName FROM Scores", -1, ref stmt, 0);
|
||||
else
|
||||
res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName, Date FROM Scores", -1, ref stmt, 0);
|
||||
@@ -956,7 +950,7 @@ namespace Vocaluxe.Base
|
||||
reader.Read();
|
||||
byte[] data = _GetBytes(reader);
|
||||
reader.Dispose();
|
||||
tex = CDraw.QuequeTexture(w, h, ref data);
|
||||
tex = CDraw.EnqueueTexture(w, h, ref data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1006,7 +1000,7 @@ namespace Vocaluxe.Base
|
||||
origin.Dispose();
|
||||
}
|
||||
|
||||
tex = CDraw.QuequeTexture(w, h, ref data);
|
||||
tex = CDraw.EnqueueTexture(w, h, ref data);
|
||||
|
||||
command.CommandText = "INSERT INTO Cover (Path, width, height) VALUES (@path, @w, @h)";
|
||||
command.Parameters.Add("@w", DbType.Int32).Value = w;
|
||||
|
||||
@@ -211,9 +211,9 @@ namespace Vocaluxe.Base
|
||||
return _Draw.AddTexture(w, h, ref data);
|
||||
}
|
||||
|
||||
public static STexture QuequeTexture(int w, int h, ref byte[] data)
|
||||
public static STexture EnqueueTexture(int w, int h, ref byte[] data)
|
||||
{
|
||||
return _Draw.QuequeTexture(w, h, ref data);
|
||||
return _Draw.EnqueueTexture(w, h, ref data);
|
||||
}
|
||||
|
||||
public static bool UpdateTexture(ref STexture texture, ref byte[] data)
|
||||
|
||||
+27
-39
@@ -19,7 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Vocaluxe.GameModes;
|
||||
using Vocaluxe.SongQueue;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SingNotes;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
@@ -28,7 +28,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
static class CGame
|
||||
{
|
||||
private static IGameMode _GameMode;
|
||||
private static ISongQueue _SongQueue;
|
||||
private static int _NumPlayer = CConfig.NumPlayer;
|
||||
|
||||
private static int _OldBeatD;
|
||||
@@ -64,103 +64,97 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_GameMode = new CGameModeNormal();
|
||||
_GameMode.Init();
|
||||
_SongQueue = new CSongQueue();
|
||||
_SongQueue.Init();
|
||||
Players = new SPlayer[CSettings.MaxNumPlayer];
|
||||
ResetPlayer();
|
||||
|
||||
CConfig.UsePlayers();
|
||||
}
|
||||
|
||||
public static void EnterNormalGame()
|
||||
{
|
||||
_GameMode = new CGameModeNormal();
|
||||
_GameMode.Init();
|
||||
}
|
||||
|
||||
public static EGameMode GameMode
|
||||
{
|
||||
get { return _GameMode.GetCurrentGameMode(); }
|
||||
get { return _SongQueue.GetCurrentGameMode(); }
|
||||
}
|
||||
|
||||
public static bool AddVisibleSong(int visibleIndex, EGameMode gameMode)
|
||||
{
|
||||
return _GameMode.AddVisibleSong(visibleIndex, gameMode);
|
||||
return _SongQueue.AddVisibleSong(visibleIndex, gameMode);
|
||||
}
|
||||
|
||||
public static bool AddSong(int absoluteIndex, EGameMode gameMode)
|
||||
{
|
||||
return _GameMode.AddSong(absoluteIndex, gameMode);
|
||||
return _SongQueue.AddSong(absoluteIndex, gameMode);
|
||||
}
|
||||
|
||||
public static bool RemoveVisibleSong(int visibleIndex)
|
||||
{
|
||||
return _GameMode.RemoveVisibleSong(visibleIndex);
|
||||
return _SongQueue.RemoveVisibleSong(visibleIndex);
|
||||
}
|
||||
|
||||
public static bool RemoveSong(int absoluteIndex)
|
||||
{
|
||||
return _GameMode.RemoveSong(absoluteIndex);
|
||||
return _SongQueue.RemoveSong(absoluteIndex);
|
||||
}
|
||||
|
||||
public static void ClearSongs()
|
||||
{
|
||||
_GameMode.ClearSongs();
|
||||
_SongQueue.ClearSongs();
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
_GameMode.Reset();
|
||||
_SongQueue.Reset();
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
_GameMode.Start(Players);
|
||||
_SongQueue.Start(Players);
|
||||
}
|
||||
|
||||
public static void NextRound()
|
||||
{
|
||||
_GameMode.NextRound(Players);
|
||||
_SongQueue.NextRound(Players);
|
||||
}
|
||||
|
||||
public static bool IsFinished()
|
||||
{
|
||||
return _GameMode.IsFinished();
|
||||
return _SongQueue.IsFinished();
|
||||
}
|
||||
|
||||
public static int RoundNr
|
||||
{
|
||||
get { return _GameMode.GetCurrentRoundNr(); }
|
||||
get { return _SongQueue.GetCurrentRoundNr(); }
|
||||
}
|
||||
|
||||
public static CSong GetSong()
|
||||
{
|
||||
return _GameMode.GetSong();
|
||||
return _SongQueue.GetSong();
|
||||
}
|
||||
|
||||
public static CSong GetSong(int num)
|
||||
{
|
||||
return _GameMode.GetSong(num);
|
||||
return _SongQueue.GetSong(num);
|
||||
}
|
||||
|
||||
public static EGameMode GetGameMode(int num)
|
||||
{
|
||||
return _GameMode.GetGameMode(num);
|
||||
return _SongQueue.GetGameMode(num);
|
||||
}
|
||||
|
||||
public static int GetNumSongs()
|
||||
{
|
||||
return _GameMode.GetNumSongs();
|
||||
return _SongQueue.GetNumSongs();
|
||||
}
|
||||
|
||||
public static CPoints GetPoints()
|
||||
{
|
||||
return _GameMode.GetPoints();
|
||||
return _SongQueue.GetPoints();
|
||||
}
|
||||
|
||||
public static int NumRounds
|
||||
{
|
||||
get { return _GameMode.GetNumSongs(); }
|
||||
get { return _SongQueue.GetNumSongs(); }
|
||||
}
|
||||
|
||||
public static int NumPlayer
|
||||
@@ -200,7 +194,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void UpdatePoints(float time)
|
||||
{
|
||||
CSong song = _GameMode.GetSong();
|
||||
CSong song = _SongQueue.GetSong();
|
||||
|
||||
if (song == null)
|
||||
return;
|
||||
@@ -225,8 +219,8 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
for (int beat = _OldBeatD + 1; beat <= ActBeatD; beat++)
|
||||
{
|
||||
if ((_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) ||
|
||||
(_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
|
||||
if ((_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) ||
|
||||
(_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
|
||||
Players[p].SongFinished = true;
|
||||
|
||||
CLine[] lines = song.Notes.GetVoice(Players[p].LineNr).Lines;
|
||||
@@ -252,15 +246,9 @@ namespace Vocaluxe.Base
|
||||
Players[p].SingLine.Add(new CLine());
|
||||
|
||||
CNote[] notes = lines[line].Notes;
|
||||
int note = -1;
|
||||
for (int j = 0; j < notes.Length; j++)
|
||||
{
|
||||
if (beat >= notes[j].StartBeat && beat <= notes[j].EndBeat)
|
||||
{
|
||||
note = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int note = lines[line].FindPreviousNote(beat);
|
||||
if (note >= 0 && notes[note].EndBeat < beat)
|
||||
note = -1;
|
||||
|
||||
if (note >= 0)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base.Font;
|
||||
using Vocaluxe.Screens;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.PartyModes;
|
||||
@@ -319,7 +320,7 @@ namespace Vocaluxe.Base
|
||||
CVideo.Update();
|
||||
CSound.Update();
|
||||
CBackgroundMusic.Update();
|
||||
CInput.Update();
|
||||
CController.Update();
|
||||
|
||||
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing)
|
||||
CSongs.LoadCover();
|
||||
@@ -504,14 +505,14 @@ namespace Vocaluxe.Base
|
||||
|
||||
bool popupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord;
|
||||
//Hide volume control for bg-music if bg-music is disabled
|
||||
if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1))
|
||||
if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || CSongs.Category == -1)
|
||||
&& _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF)
|
||||
popupVolumeControlAllowed = false;
|
||||
|
||||
|
||||
bool resume = true;
|
||||
bool eventsAvailable;
|
||||
bool inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent);
|
||||
bool inputEventsAvailable = CController.PollKeyEvent(ref inputKeyEvent);
|
||||
|
||||
while ((eventsAvailable = keys.PollEvent(ref keyEvent)) || inputEventsAvailable)
|
||||
{
|
||||
@@ -616,10 +617,10 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
if (!eventsAvailable)
|
||||
inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent);
|
||||
inputEventsAvailable = CController.PollKeyEvent(ref inputKeyEvent);
|
||||
}
|
||||
|
||||
inputEventsAvailable = CInput.PollMouseEvent(ref inputMouseEvent);
|
||||
inputEventsAvailable = CController.PollMouseEvent(ref inputMouseEvent);
|
||||
|
||||
while ((eventsAvailable = mouse.PollEvent(ref mouseEvent)) || inputEventsAvailable)
|
||||
{
|
||||
@@ -677,7 +678,7 @@ namespace Vocaluxe.Base
|
||||
resume &= _Screens[(int)_CurrentScreen].HandleMouse(mouseEvent);
|
||||
|
||||
if (!eventsAvailable)
|
||||
inputEventsAvailable = CInput.PollMouseEvent(ref inputMouseEvent);
|
||||
inputEventsAvailable = CController.PollMouseEvent(ref inputMouseEvent);
|
||||
}
|
||||
return resume;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using VocaluxeLib.Menu;
|
||||
@@ -168,12 +169,7 @@ namespace Vocaluxe.Base
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(CHelper.ListFiles(path, "*.xml", true, true));
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (!_LoadPartyLanguageFile(partyModeID, file))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return files.All(file => _LoadPartyLanguageFile(partyModeID, file));
|
||||
}
|
||||
|
||||
private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary<string, string> texts)
|
||||
|
||||
+18
-11
@@ -19,7 +19,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using Vocaluxe.Base.Font;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
|
||||
@@ -44,13 +46,13 @@ namespace Vocaluxe.Base
|
||||
private static readonly ISound _Sound = new CBsound();
|
||||
private static readonly ICover _Cover = new CBcover();
|
||||
private static readonly IDataBase _DataBase = new CBdataBase();
|
||||
private static readonly IInputs _Input = new CBinputs();
|
||||
private static readonly IControllers _Controller = new CBcontrollers();
|
||||
private static readonly IPlaylist _Playlist = new CBplaylist();
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
CBase.Assign(_Config, _Settings, _Theme, _Log, _BackgroundMusic, _Draw, _Graphics, _Fonts, _Language,
|
||||
_Game, _Profiles, _Record, _Songs, _Video, _Sound, _Cover, _DataBase, _Input, _Playlist);
|
||||
_Game, _Profiles, _Record, _Songs, _Video, _Sound, _Cover, _DataBase, _Controller, _Playlist);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,9 +569,9 @@ namespace Vocaluxe.Base
|
||||
return CSongs.NumAllSongs;
|
||||
}
|
||||
|
||||
public int GetNumVisibleSongs()
|
||||
public int GetNumSongsVisible()
|
||||
{
|
||||
return CSongs.NumVisibleSongs;
|
||||
return CSongs.NumSongsVisible;
|
||||
}
|
||||
|
||||
public int GetNumCategories()
|
||||
@@ -582,6 +584,11 @@ namespace Vocaluxe.Base
|
||||
return CSongs.NumSongsInCategory(categoryIndex);
|
||||
}
|
||||
|
||||
public bool IsInCategory()
|
||||
{
|
||||
return CSongs.IsInCategory;
|
||||
}
|
||||
|
||||
public int GetCurrentCategoryIndex()
|
||||
{
|
||||
return CSongs.Category;
|
||||
@@ -617,14 +624,14 @@ namespace Vocaluxe.Base
|
||||
return CSongs.GetSong(songID);
|
||||
}
|
||||
|
||||
public CSong[] GetSongs()
|
||||
public ReadOnlyCollection<CSong> GetSongs()
|
||||
{
|
||||
return CSongs.AllSongs;
|
||||
}
|
||||
|
||||
public CSong[] GetSongsNotSung()
|
||||
public ReadOnlyCollection<CSong> GetVisibleSongs()
|
||||
{
|
||||
return CSongs.SongsNotSung;
|
||||
return CSongs.VisibleSongs;
|
||||
}
|
||||
|
||||
public CCategory GetCategory(int index)
|
||||
@@ -640,12 +647,12 @@ namespace Vocaluxe.Base
|
||||
CSongs.AddPartySongSung(songID);
|
||||
}
|
||||
|
||||
public void ResetPartySongSung()
|
||||
public void ResetSongSung()
|
||||
{
|
||||
CSongs.ResetPartySongSung();
|
||||
}
|
||||
|
||||
public void ResetPartySongSung(int catIndex)
|
||||
public void ResetSongSung(int catIndex)
|
||||
{
|
||||
CSongs.ResetPartySongSung(catIndex);
|
||||
}
|
||||
@@ -763,11 +770,11 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
}
|
||||
|
||||
class CBinputs : IInputs
|
||||
class CBcontrollers : IControllers
|
||||
{
|
||||
public void SetRumble(float duration)
|
||||
{
|
||||
CInput.SetRumble(duration);
|
||||
CController.SetRumble(duration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Vocaluxe.Lib.Playlist;
|
||||
@@ -223,7 +224,7 @@ namespace Vocaluxe.Base
|
||||
private static CPlaylistFile _ConvertUSDXPlaylist(string file)
|
||||
{
|
||||
CPlaylistFile pl = new CPlaylistFile();
|
||||
CSong[] allSongs = CSongs.AllSongs;
|
||||
ReadOnlyCollection<CSong> allSongs = CSongs.AllSongs;
|
||||
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public CSongCategorizer()
|
||||
{
|
||||
CSongs.Filter.ObjectChanged += _HandleSortedSongsChanged;
|
||||
CSongs.Sorter.ObjectChanged += _HandleSortedSongsChanged;
|
||||
}
|
||||
|
||||
public List<CCategory> Categories
|
||||
@@ -49,11 +49,12 @@ namespace Vocaluxe.Base
|
||||
get { return _Tabs; }
|
||||
set
|
||||
{
|
||||
if (value != _Tabs)
|
||||
{
|
||||
_Tabs = value;
|
||||
_SetChanged();
|
||||
}
|
||||
if (value == _Tabs)
|
||||
return;
|
||||
_Tabs = value;
|
||||
if (_Tabs == EOffOn.TR_CONFIG_ON)
|
||||
CSongs.Category = -1;
|
||||
_SetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,58 +65,55 @@ namespace Vocaluxe.Base
|
||||
|
||||
private void _CreateCategoriesLetter()
|
||||
{
|
||||
string category = "";
|
||||
int notLetterCat = -1;
|
||||
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
|
||||
CCategory lastCategory = null;
|
||||
CCategory notLetterCat = null;
|
||||
foreach (CSongPointer songPointer in CSongs.Sorter.SortedSongs)
|
||||
{
|
||||
Char firstLetter = Char.ToUpper(CSongs.Sorter.SortedSongs[i].SortString.Normalize(NormalizationForm.FormD)[0]);
|
||||
|
||||
if (!Char.IsLetter(firstLetter))
|
||||
firstLetter = '#';
|
||||
if (firstLetter.ToString() != category)
|
||||
Char firstLetter = Char.ToUpper(songPointer.SortString.Normalize(NormalizationForm.FormD)[0]);
|
||||
if (Char.IsLetter(firstLetter))
|
||||
{
|
||||
if (firstLetter != '#' || notLetterCat == -1)
|
||||
if (lastCategory == null || songPointer.SortString != lastCategory.Name)
|
||||
{
|
||||
category = firstLetter.ToString();
|
||||
_Categories.Add(new CCategory(category));
|
||||
|
||||
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
|
||||
|
||||
if (firstLetter == '#')
|
||||
notLetterCat = CSongs.Sorter.SortedSongs[i].CatIndex;
|
||||
lastCategory = new CCategory(songPointer.SortString);
|
||||
_Categories.Add(lastCategory);
|
||||
}
|
||||
else
|
||||
CSongs.Sorter.SortedSongs[i].CatIndex = notLetterCat;
|
||||
lastCategory.Songs.Add(songPointer);
|
||||
}
|
||||
else
|
||||
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
|
||||
{
|
||||
if (notLetterCat == null)
|
||||
{
|
||||
notLetterCat = new CCategory("#");
|
||||
_Categories.Add(notLetterCat);
|
||||
}
|
||||
notLetterCat.Songs.Add(songPointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _CreateCategoriesNormal(string noCategoryName)
|
||||
{
|
||||
string category = "";
|
||||
int noCategoryIndex = -1;
|
||||
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
|
||||
CCategory lastCategory = null;
|
||||
CCategory noCategory = null;
|
||||
foreach (CSongPointer songPointer in CSongs.Sorter.SortedSongs)
|
||||
{
|
||||
if (CSongs.Sorter.SortedSongs[i].SortString != "")
|
||||
if (songPointer.SortString != "")
|
||||
{
|
||||
if (CSongs.Sorter.SortedSongs[i].SortString != category)
|
||||
if (lastCategory == null || songPointer.SortString != lastCategory.Name)
|
||||
{
|
||||
category = CSongs.Sorter.SortedSongs[i].SortString;
|
||||
_Categories.Add(new CCategory(category));
|
||||
lastCategory = new CCategory(songPointer.SortString);
|
||||
_Categories.Add(lastCategory);
|
||||
}
|
||||
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
|
||||
lastCategory.Songs.Add(songPointer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (noCategoryIndex < 0)
|
||||
if (noCategory == null)
|
||||
{
|
||||
category = noCategoryName;
|
||||
_Categories.Add(new CCategory(category));
|
||||
noCategoryIndex = _Categories.Count - 1;
|
||||
noCategory = new CCategory(noCategoryName);
|
||||
_Categories.Add(noCategory);
|
||||
}
|
||||
CSongs.Sorter.SortedSongs[i].CatIndex = noCategoryIndex;
|
||||
noCategory.Songs.Add(songPointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,13 +149,13 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
if (sorting == ESongSorting.TR_CONFIG_DECADE)
|
||||
{
|
||||
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
|
||||
foreach (CSongPointer songPointer in CSongs.Sorter.SortedSongs)
|
||||
{
|
||||
string year = CSongs.Sorter.SortedSongs[i].SortString;
|
||||
string year = songPointer.SortString;
|
||||
if (year != "")
|
||||
{
|
||||
year = year.Substring(0, 3);
|
||||
CSongs.Sorter.SortedSongs[i].SortString = year + "0 - " + year + "9";
|
||||
songPointer.SortString = year + "0 - " + year + "9";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,15 +170,14 @@ namespace Vocaluxe.Base
|
||||
|
||||
_Categories.Clear();
|
||||
|
||||
if (_Tabs == EOffOn.TR_CONFIG_OFF)
|
||||
if (_Tabs != EOffOn.TR_CONFIG_OFF)
|
||||
_CreateCategories();
|
||||
else
|
||||
{
|
||||
//No categories. So don't create them!
|
||||
_Categories.Add(new CCategory(""));
|
||||
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
|
||||
CSongs.Sorter.SortedSongs[i].CatIndex = 0;
|
||||
_Categories[0].Songs.AddRange(CSongs.Sorter.SortedSongs);
|
||||
}
|
||||
else
|
||||
_CreateCategories();
|
||||
|
||||
foreach (CCategory cat in _Categories)
|
||||
cat.CoverTextureSmall = CCover.Cover(cat.Name);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
class CSongSorter : CObservable
|
||||
{
|
||||
private SSongPointer[] _SortedSongs = new SSongPointer[0];
|
||||
private CSongPointer[] _SortedSongs = new CSongPointer[0];
|
||||
private EOffOn _IgnoreArticles = CConfig.IgnoreArticles;
|
||||
private ESongSorting _SongSorting = CConfig.SongSorting;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Vocaluxe.Base
|
||||
CSongs.Filter.ObjectChanged += _HandleFilteredSongsChanged;
|
||||
}
|
||||
|
||||
public SSongPointer[] SortedSongs
|
||||
public CSongPointer[] SortedSongs
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -84,7 +84,7 @@ namespace Vocaluxe.Base
|
||||
_SetChanged();
|
||||
}
|
||||
|
||||
private int _SortByFieldArtistTitle(SSongPointer s1, SSongPointer s2)
|
||||
private int _SortByFieldArtistTitle(CSongPointer s1, CSongPointer s2)
|
||||
{
|
||||
int res = String.Compare(s1.SortString, s2.SortString, StringComparison.OrdinalIgnoreCase);
|
||||
if (res == 0)
|
||||
@@ -100,7 +100,7 @@ namespace Vocaluxe.Base
|
||||
return res;
|
||||
}
|
||||
|
||||
private int _SortByFieldTitle(SSongPointer s1, SSongPointer s2)
|
||||
private int _SortByFieldTitle(CSongPointer s1, CSongPointer s2)
|
||||
{
|
||||
int res = String.Compare(s1.SortString, s2.SortString, StringComparison.OrdinalIgnoreCase);
|
||||
if (res == 0)
|
||||
@@ -112,11 +112,11 @@ namespace Vocaluxe.Base
|
||||
return res;
|
||||
}
|
||||
|
||||
private List<SSongPointer> _CreateSortList(string fieldName)
|
||||
private List<CSongPointer> _CreateSortList(string fieldName)
|
||||
{
|
||||
List<SSongPointer> sortList = new List<SSongPointer>();
|
||||
List<CSongPointer> sortList = new List<CSongPointer>();
|
||||
if (fieldName == "")
|
||||
CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new SSongPointer(song.ID, "")));
|
||||
CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new CSongPointer(song.ID, "")));
|
||||
else
|
||||
{
|
||||
FieldInfo field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
|
||||
@@ -132,16 +132,16 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
object value = field.GetValue(song);
|
||||
if (isString)
|
||||
sortList.Add(new SSongPointer(song.ID, (String)value));
|
||||
sortList.Add(new CSongPointer(song.ID, (String)value));
|
||||
else
|
||||
{
|
||||
List<String> values = (List<String>)value;
|
||||
if (values.Count == 0)
|
||||
sortList.Add(new SSongPointer(song.ID, ""));
|
||||
sortList.Add(new CSongPointer(song.ID, ""));
|
||||
else
|
||||
{
|
||||
foreach (String sortString in values)
|
||||
sortList.Add(new SSongPointer(song.ID, sortString));
|
||||
sortList.Add(new CSongPointer(song.ID, sortString));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ namespace Vocaluxe.Base
|
||||
fieldName = "";
|
||||
break;
|
||||
}
|
||||
List<SSongPointer> sortList = _CreateSortList(fieldName);
|
||||
List<CSongPointer> sortList = _CreateSortList(fieldName);
|
||||
switch (_SongSorting)
|
||||
{
|
||||
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
|
||||
|
||||
+64
-148
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using VocaluxeLib.Menu;
|
||||
@@ -26,33 +27,12 @@ using VocaluxeLib.Menu.SongMenu;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
{
|
||||
public struct SSongPointer
|
||||
{
|
||||
public readonly int SongID;
|
||||
public string SortString;
|
||||
|
||||
public int CatIndex;
|
||||
public bool Visible;
|
||||
public bool PartyHidden;
|
||||
|
||||
public SSongPointer(int id, string sortString)
|
||||
{
|
||||
SongID = id;
|
||||
SortString = sortString;
|
||||
CatIndex = -1;
|
||||
Visible = false;
|
||||
PartyHidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
static class CSongs
|
||||
{
|
||||
private static readonly List<CSong> _Songs = new List<CSong>();
|
||||
private static readonly List<CSong> _SongsForRandom = new List<CSong>();
|
||||
|
||||
private static bool _SongsLoaded;
|
||||
private static bool _CoverLoaded;
|
||||
private static int _CoverLoadIndex;
|
||||
private static int _CatIndex = -1;
|
||||
private static readonly List<CCategory> _CategoriesForRandom = new List<CCategory>();
|
||||
|
||||
@@ -67,16 +47,13 @@ namespace Vocaluxe.Base
|
||||
get { return _Songs; }
|
||||
}
|
||||
|
||||
public static bool SongsLoaded
|
||||
{
|
||||
get { return _SongsLoaded; }
|
||||
}
|
||||
public static bool SongsLoaded { get; private set; }
|
||||
|
||||
public static bool CoverLoaded
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_SongsLoaded && NumAllSongs == 0)
|
||||
if (SongsLoaded && NumAllSongs == 0)
|
||||
_CoverLoaded = true;
|
||||
return _CoverLoaded;
|
||||
}
|
||||
@@ -87,34 +64,39 @@ namespace Vocaluxe.Base
|
||||
get { return _Songs.Count; }
|
||||
}
|
||||
|
||||
public static int NumVisibleSongs
|
||||
public static int NumSongsVisible
|
||||
{
|
||||
get { return Sorter.SortedSongs.Count(sp => sp.Visible); }
|
||||
get { return _CatIndex < 0 ? 0 : Categories[_CatIndex].Songs.Count(sp => !sp.IsSung); }
|
||||
}
|
||||
|
||||
public static int NumCategories
|
||||
{
|
||||
get { return Categorizer.Categories.Count; }
|
||||
get { return Categories.Count; }
|
||||
}
|
||||
|
||||
public static int Category
|
||||
{
|
||||
get { return _CatIndex; }
|
||||
get
|
||||
{
|
||||
if (_CatIndex >= Categories.Count)
|
||||
_CatIndex = -1;
|
||||
return _CatIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value >= -1 && value < Categorizer.Categories.Count)
|
||||
{
|
||||
if (value == -1 || _IsCatIndexValid(value))
|
||||
_CatIndex = value;
|
||||
|
||||
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
|
||||
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsInCategory
|
||||
{
|
||||
get { return _CatIndex >= 0; }
|
||||
get { return _IsCatIndexValid(_CatIndex); }
|
||||
}
|
||||
|
||||
private static bool _IsCatIndexValid(int catIndex)
|
||||
{
|
||||
return catIndex >= 0 && catIndex < Categories.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -124,21 +106,12 @@ namespace Vocaluxe.Base
|
||||
/// <returns></returns>
|
||||
public static int NumSongsInCategory(int catIndex)
|
||||
{
|
||||
if (Categorizer.Categories.Count <= catIndex || catIndex < 0)
|
||||
return 0;
|
||||
|
||||
int num = 0;
|
||||
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
|
||||
{
|
||||
if (Sorter.SortedSongs[i].CatIndex == catIndex && !Sorter.SortedSongs[i].PartyHidden)
|
||||
num++;
|
||||
}
|
||||
return num;
|
||||
return _IsCatIndexValid(catIndex) ? Categories[catIndex].Songs.Count(sp => !sp.IsSung) : 0;
|
||||
}
|
||||
|
||||
public static void NextCategory()
|
||||
{
|
||||
if (Category == Categorizer.Categories.Count - 1)
|
||||
if (Category == Categories.Count - 1)
|
||||
Category = 0;
|
||||
else
|
||||
Category++;
|
||||
@@ -147,7 +120,7 @@ namespace Vocaluxe.Base
|
||||
public static void PrevCategory()
|
||||
{
|
||||
if (Category == 0)
|
||||
Category = Categorizer.Categories.Count - 1;
|
||||
Category = Categories.Count - 1;
|
||||
else
|
||||
Category--;
|
||||
}
|
||||
@@ -157,44 +130,21 @@ namespace Vocaluxe.Base
|
||||
if (!SongsLoaded)
|
||||
return -1;
|
||||
|
||||
if (_CoverLoadIndex < _Songs.Count)
|
||||
if (NumSongsWithCoverLoaded < _Songs.Count)
|
||||
{
|
||||
song = _Songs[_CoverLoadIndex];
|
||||
_CoverLoadIndex++;
|
||||
return _CoverLoadIndex;
|
||||
song = _Songs[NumSongsWithCoverLoaded];
|
||||
NumSongsWithCoverLoaded++;
|
||||
return NumSongsWithCoverLoaded;
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
public static int NumSongsWithCoverLoaded
|
||||
{
|
||||
get { return _CoverLoadIndex; }
|
||||
}
|
||||
|
||||
public static void SetCoverSmall(int songIndex, STexture texture)
|
||||
{
|
||||
if (!_SongsLoaded)
|
||||
return;
|
||||
|
||||
if (songIndex < _Songs.Count)
|
||||
_Songs[songIndex].CoverTextureSmall = texture;
|
||||
}
|
||||
|
||||
public static void SetCoverBig(int songIndex, STexture texture)
|
||||
{
|
||||
if (!_SongsLoaded)
|
||||
return;
|
||||
|
||||
if (songIndex < _Songs.Count)
|
||||
_Songs[songIndex].CoverTextureBig = texture;
|
||||
}
|
||||
public static int NumSongsWithCoverLoaded { get; private set; }
|
||||
|
||||
public static string GetCurrentCategoryName()
|
||||
{
|
||||
if ((Categorizer.Categories.Count > 0) && (_CatIndex >= 0) && (Categorizer.Categories.Count > _CatIndex))
|
||||
return Categorizer.Categories[_CatIndex].Name;
|
||||
return String.Empty;
|
||||
return _IsCatIndexValid(_CatIndex) ? Categories[_CatIndex].Name : "";
|
||||
}
|
||||
|
||||
public static CSong GetSong(int songID)
|
||||
@@ -204,43 +154,31 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void AddPartySongSung(int songID)
|
||||
{
|
||||
int cat = -1;
|
||||
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
|
||||
foreach (CCategory category in Categories)
|
||||
{
|
||||
if (songID == Sorter.SortedSongs[i].SongID)
|
||||
foreach (CSongPointer song in category.Songs.Where(song => song.SongID == songID))
|
||||
{
|
||||
Sorter.SortedSongs[i].PartyHidden = true;
|
||||
Sorter.SortedSongs[i].Visible = false;
|
||||
cat = Sorter.SortedSongs[i].CatIndex;
|
||||
break;
|
||||
song.IsSung = true;
|
||||
int catIndex = _GetCategoryNumber(category);
|
||||
if (NumSongsInCategory(catIndex) == 0)
|
||||
ResetPartySongSung(catIndex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (cat != -1)
|
||||
{
|
||||
if (NumSongsInCategory(cat) == 0)
|
||||
ResetPartySongSung(cat);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ResetPartySongSung()
|
||||
{
|
||||
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
|
||||
{
|
||||
Sorter.SortedSongs[i].PartyHidden = false;
|
||||
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
|
||||
}
|
||||
foreach (CSongPointer song in Sorter.SortedSongs)
|
||||
song.IsSung = false;
|
||||
}
|
||||
|
||||
public static void ResetPartySongSung(int catIndex)
|
||||
{
|
||||
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
|
||||
if (_IsCatIndexValid(catIndex))
|
||||
{
|
||||
if (Sorter.SortedSongs[i].CatIndex == catIndex)
|
||||
{
|
||||
Sorter.SortedSongs[i].PartyHidden = false;
|
||||
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
|
||||
}
|
||||
foreach (CSongPointer song in Categories[catIndex].Songs)
|
||||
song.IsSung = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +234,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
private static int _GetCategoryNumber(CCategory category)
|
||||
{
|
||||
for (int i = 0; i < Categories.Length; i++)
|
||||
for (int i = 0; i < Categories.Count; i++)
|
||||
{
|
||||
if (Categories[i] == category)
|
||||
return i;
|
||||
@@ -304,65 +242,44 @@ namespace Vocaluxe.Base
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static CSong[] AllSongs
|
||||
public static ReadOnlyCollection<CSong> AllSongs
|
||||
{
|
||||
get { return _Songs.ToArray(); }
|
||||
get { return _Songs.AsReadOnly(); }
|
||||
}
|
||||
|
||||
public static CSong[] SongsNotSung
|
||||
public static ReadOnlyCollection<CSong> VisibleSongs
|
||||
{
|
||||
get
|
||||
{
|
||||
List<CSong> songs = new List<CSong>();
|
||||
foreach (SSongPointer sp in Sorter.SortedSongs)
|
||||
if (_IsCatIndexValid(_CatIndex))
|
||||
{
|
||||
if (sp.Visible)
|
||||
songs.Add(_Songs[sp.SongID]);
|
||||
foreach (CSongPointer sp in Categories[_CatIndex].Songs)
|
||||
{
|
||||
if (!sp.IsSung)
|
||||
songs.Add(_Songs[sp.SongID]);
|
||||
}
|
||||
}
|
||||
return songs.ToArray();
|
||||
return songs.AsReadOnly();
|
||||
}
|
||||
}
|
||||
|
||||
public static CSong[] VisibleSongs
|
||||
public static ReadOnlyCollection<CCategory> Categories
|
||||
{
|
||||
get
|
||||
{
|
||||
List<CSong> songs = new List<CSong>();
|
||||
foreach (SSongPointer sp in Sorter.SortedSongs)
|
||||
{
|
||||
if (sp.Visible)
|
||||
songs.Add(_Songs[sp.SongID]);
|
||||
}
|
||||
return songs.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static CCategory[] Categories
|
||||
{
|
||||
get { return Categorizer.Categories.ToArray(); }
|
||||
get { return Categorizer.Categories.AsReadOnly(); }
|
||||
}
|
||||
|
||||
public static CSong GetVisibleSongByIndex(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
return null;
|
||||
|
||||
foreach (SSongPointer sp in Sorter.SortedSongs)
|
||||
{
|
||||
if (sp.Visible)
|
||||
{
|
||||
if (index == 0)
|
||||
return _Songs[sp.SongID];
|
||||
index--;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
ReadOnlyCollection<CSong> visSongs = VisibleSongs;
|
||||
return (index < visSongs.Count) ? visSongs[index] : null;
|
||||
}
|
||||
|
||||
private static void _HandleCategoriesChanged(object sender, EventArgs args)
|
||||
{
|
||||
_CategoriesForRandom.Clear();
|
||||
Category = _CatIndex;
|
||||
}
|
||||
|
||||
public static void Sort(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions)
|
||||
@@ -375,7 +292,7 @@ namespace Vocaluxe.Base
|
||||
public static void LoadSongs()
|
||||
{
|
||||
CLog.StartBenchmark(1, "Load Songs");
|
||||
_SongsLoaded = false;
|
||||
SongsLoaded = false;
|
||||
_Songs.Clear();
|
||||
|
||||
CLog.StartBenchmark(2, "List Songs");
|
||||
@@ -392,12 +309,11 @@ namespace Vocaluxe.Base
|
||||
foreach (string file in files)
|
||||
{
|
||||
CSong song = CSong.LoadSong(file);
|
||||
if (song != null)
|
||||
{
|
||||
song.ID = _Songs.Count;
|
||||
if (song.ReadNotes())
|
||||
_Songs.Add(song);
|
||||
}
|
||||
if (song == null)
|
||||
continue;
|
||||
song.ID = _Songs.Count;
|
||||
if (song.ReadNotes())
|
||||
_Songs.Add(song);
|
||||
}
|
||||
CLog.StopBenchmark(2, "Read TXTs");
|
||||
|
||||
@@ -408,7 +324,7 @@ namespace Vocaluxe.Base
|
||||
Categorizer.ObjectChanged += _HandleCategoriesChanged;
|
||||
CLog.StopBenchmark(2, "Sort Songs");
|
||||
Category = -1;
|
||||
_SongsLoaded = true;
|
||||
SongsLoaded = true;
|
||||
|
||||
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART)
|
||||
{
|
||||
@@ -423,7 +339,7 @@ namespace Vocaluxe.Base
|
||||
public static void LoadCover()
|
||||
{
|
||||
if (CConfig.Renderer == ERenderer.TR_CONFIG_SOFTWARE)
|
||||
return; //should be removed as soon as the other renderer are ready for queque
|
||||
return; //should be removed as soon as the other renderer are ready for queue
|
||||
|
||||
if (!SongsLoaded || CoverLoaded)
|
||||
return;
|
||||
@@ -460,7 +376,7 @@ namespace Vocaluxe.Base
|
||||
foreach (CSong song in _Songs)
|
||||
{
|
||||
song.LoadSmallCover();
|
||||
_CoverLoadIndex++;
|
||||
NumSongsWithCoverLoaded++;
|
||||
}
|
||||
GC.Collect();
|
||||
_CoverLoaded = true;
|
||||
|
||||
+8
-17
@@ -18,6 +18,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Vocaluxe.Lib.Sound;
|
||||
@@ -226,9 +227,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static bool RecordStart()
|
||||
{
|
||||
SRecordDevice[] devices = RecordGetDevices();
|
||||
|
||||
return _Record.Start(devices);
|
||||
return _Record.Start();
|
||||
}
|
||||
|
||||
public static bool RecordStop()
|
||||
@@ -276,23 +275,16 @@ namespace Vocaluxe.Base
|
||||
return _Record.ToneWeigth(player);
|
||||
}
|
||||
|
||||
public static SRecordDevice[] RecordGetDevices()
|
||||
public static ReadOnlyCollection<CRecordDevice> RecordGetDevices()
|
||||
{
|
||||
SRecordDevice[] devices = _Record.RecordDevices();
|
||||
ReadOnlyCollection<CRecordDevice> devices = _Record.RecordDevices();
|
||||
|
||||
if (devices != null)
|
||||
{
|
||||
for (int dev = 0; dev < devices.Length; dev++)
|
||||
foreach (CRecordDevice device in devices)
|
||||
{
|
||||
for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
|
||||
{
|
||||
SInput input = devices[dev].Inputs[inp];
|
||||
|
||||
input.PlayerChannel1 = _GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 1);
|
||||
input.PlayerChannel2 = _GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 2);
|
||||
|
||||
devices[dev].Inputs[inp] = input;
|
||||
}
|
||||
device.PlayerChannel1 = _GetPlayerFromMicConfig(device.Name, device.Driver, 1);
|
||||
device.PlayerChannel2 = _GetPlayerFromMicConfig(device.Name, device.Driver, 2);
|
||||
}
|
||||
return devices;
|
||||
}
|
||||
@@ -300,14 +292,13 @@ namespace Vocaluxe.Base
|
||||
return null;
|
||||
}
|
||||
|
||||
private static int _GetPlayerFromMicConfig(string device, string devicedriver, string input, int channel)
|
||||
private static int _GetPlayerFromMicConfig(string device, string devicedriver, int channel)
|
||||
{
|
||||
for (int p = 0; p < CSettings.MaxNumPlayer; p++)
|
||||
{
|
||||
if (CConfig.MicConfig[p].Channel != 0 &&
|
||||
CConfig.MicConfig[p].DeviceName == device &&
|
||||
CConfig.MicConfig[p].DeviceDriver == devicedriver &&
|
||||
CConfig.MicConfig[p].InputName == input &&
|
||||
CConfig.MicConfig[p].Channel == channel)
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using Vocaluxe.Base.Font;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
#region license
|
||||
// /*
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Text;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Base.Font
|
||||
{
|
||||
class CFont : IDisposable
|
||||
{
|
||||
private readonly Dictionary<char, CGlyph> _Glyphs;
|
||||
private PrivateFontCollection _Fonts;
|
||||
private FontFamily _Family;
|
||||
private readonly float _Sizeh;
|
||||
|
||||
public readonly string FilePath;
|
||||
|
||||
public CFont(string file)
|
||||
{
|
||||
FilePath = file;
|
||||
|
||||
_Glyphs = new Dictionary<char, CGlyph>();
|
||||
|
||||
switch (CConfig.TextureQuality)
|
||||
{
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST:
|
||||
_Sizeh = 25f;
|
||||
break;
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_LOW:
|
||||
_Sizeh = 50f;
|
||||
break;
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM:
|
||||
_Sizeh = 100f;
|
||||
break;
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_HIGH:
|
||||
_Sizeh = 200f;
|
||||
break;
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST:
|
||||
_Sizeh = 400f;
|
||||
break;
|
||||
default:
|
||||
_Sizeh = 100f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public System.Drawing.Font GetFont()
|
||||
{
|
||||
if (_Fonts == null)
|
||||
{
|
||||
_Fonts = new PrivateFontCollection();
|
||||
try
|
||||
{
|
||||
_Fonts.AddFontFile(FilePath);
|
||||
_Family = _Fonts.Families[0];
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CLog.LogError("Error opening font file " + FilePath + ": " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return new System.Drawing.Font(_Family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color)
|
||||
{
|
||||
STexture texture;
|
||||
SRectF rect;
|
||||
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
|
||||
CDraw.DrawTexture(texture, rect, color);
|
||||
}
|
||||
|
||||
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color, float begin, float end)
|
||||
{
|
||||
STexture texture;
|
||||
SRectF rect;
|
||||
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
|
||||
CDraw.DrawTexture(texture, rect, color, begin, end);
|
||||
}
|
||||
|
||||
public void DrawGlyphReflection(char chr, float x, float y, float h, float z, SColorF color, float rspace, float rheight)
|
||||
{
|
||||
STexture texture;
|
||||
SRectF rect;
|
||||
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
|
||||
CDraw.DrawTextureReflection(texture, rect, color, rect, rspace, rheight);
|
||||
}
|
||||
|
||||
private void _GetGlyphTextureAndRect(char chr, float x, float y, float z, float h, out STexture texture, out SRectF rect)
|
||||
{
|
||||
AddGlyph(chr);
|
||||
|
||||
CFonts.Height = h;
|
||||
CGlyph glyph = _Glyphs[chr];
|
||||
texture = glyph.Texture;
|
||||
float factor = h / texture.Height;
|
||||
float width = texture.Width * factor;
|
||||
float d = glyph.Sizeh / 5f * factor;
|
||||
rect = new SRectF(x - d, y, width, h, z);
|
||||
}
|
||||
|
||||
public float GetWidth(char chr)
|
||||
{
|
||||
AddGlyph(chr);
|
||||
|
||||
CGlyph glyph = _Glyphs[chr];
|
||||
float factor = CFonts.Height / glyph.Texture.Height;
|
||||
return glyph.Width * factor;
|
||||
}
|
||||
|
||||
public float GetHeight(char chr)
|
||||
{
|
||||
return CFonts.Height;
|
||||
/*WTF???
|
||||
AddGlyph(chr);
|
||||
|
||||
CGlyph glyph = _Glyphs[chr];
|
||||
float factor = CFonts.Height / glyph.Texture.height;
|
||||
return glyph.Texture.height * factor;*/
|
||||
}
|
||||
|
||||
public void AddGlyph(char chr)
|
||||
{
|
||||
if (_Glyphs.ContainsKey(chr))
|
||||
return;
|
||||
|
||||
float h = CFonts.Height;
|
||||
_Glyphs.Add(chr, new CGlyph(chr, _Sizeh));
|
||||
CFonts.Height = h;
|
||||
}
|
||||
|
||||
public void UnloadAllGlyphs()
|
||||
{
|
||||
foreach (CGlyph glyph in _Glyphs.Values)
|
||||
glyph.UnloadTexture();
|
||||
_Glyphs.Clear();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_Fonts != null)
|
||||
{
|
||||
_Fonts.Dispose();
|
||||
_Fonts = null;
|
||||
UnloadAllGlyphs();
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
struct SFont
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public bool IsThemeFont;
|
||||
public int PartyModeID;
|
||||
public string ThemeName;
|
||||
|
||||
public string Folder;
|
||||
public string FileNormal;
|
||||
public string FileItalic;
|
||||
public string FileBold;
|
||||
public string FileBoldItalic;
|
||||
|
||||
public float Outline; //0..1, 0=not outline 1=100% outline
|
||||
public SColorF OutlineColor;
|
||||
|
||||
public CFont Normal;
|
||||
public CFont Italic;
|
||||
public CFont Bold;
|
||||
public CFont BoldItalic;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#region license
|
||||
#region license
|
||||
// /*
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
@@ -17,305 +17,16 @@
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
namespace Vocaluxe.Base.Font
|
||||
{
|
||||
class CGlyph
|
||||
{
|
||||
private readonly float _Sizeh = 50f;
|
||||
public float Sizeh
|
||||
{
|
||||
get { return _Sizeh; }
|
||||
}
|
||||
|
||||
public STexture Texture;
|
||||
public readonly int Width;
|
||||
|
||||
public CGlyph(char chr, float maxHigh)
|
||||
{
|
||||
_Sizeh = maxHigh;
|
||||
|
||||
float outline = CFonts.Outline;
|
||||
const TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix;
|
||||
|
||||
float factor = _GetFactor(chr, flags);
|
||||
CFonts.Height = Sizeh * factor;
|
||||
Font fo;
|
||||
Size sizeB;
|
||||
SizeF size;
|
||||
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
|
||||
{
|
||||
fo = CFonts.GetFont();
|
||||
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
|
||||
|
||||
size = g.MeasureString(chr.ToString(), fo);
|
||||
}
|
||||
|
||||
using (Bitmap bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height))
|
||||
{
|
||||
Graphics g = Graphics.FromImage(bmp);
|
||||
g.Clear(Color.Transparent);
|
||||
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
||||
CFonts.Height = Sizeh;
|
||||
fo = CFonts.GetFont();
|
||||
|
||||
PointF point = new PointF(
|
||||
outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + Sizeh / 5f,
|
||||
(sizeB.Height - size.Height - (size.Height + Sizeh / 4f) * (1f - factor)) / 2f);
|
||||
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(
|
||||
chr.ToString(),
|
||||
fo.FontFamily,
|
||||
(int)fo.Style,
|
||||
Sizeh,
|
||||
point,
|
||||
new StringFormat());
|
||||
|
||||
using (Pen pen = new Pen(
|
||||
Color.FromArgb(
|
||||
(int)CFonts.OutlineColor.A * 255,
|
||||
(int)CFonts.OutlineColor.R * 255,
|
||||
(int)CFonts.OutlineColor.G * 255,
|
||||
(int)CFonts.OutlineColor.B * 255),
|
||||
Sizeh * outline))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
g.DrawPath(pen, path);
|
||||
g.FillPath(Brushes.White, path);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
g.DrawString(
|
||||
chr.ToString(),
|
||||
fo,
|
||||
Brushes.White,
|
||||
point);
|
||||
* */
|
||||
Texture = CDraw.AddTexture(bmp);
|
||||
//bmp.Save("test.png", ImageFormat.Png);
|
||||
Width = (int)((1f + outline / 2f) * sizeB.Width * Texture.Width / factor / bmp.Width);
|
||||
g.Dispose();
|
||||
}
|
||||
fo.Dispose();
|
||||
}
|
||||
|
||||
public void UnloadTexture()
|
||||
{
|
||||
CDraw.RemoveTexture(ref Texture);
|
||||
}
|
||||
|
||||
private float _GetFactor(char chr, TextFormatFlags flags)
|
||||
{
|
||||
if (CFonts.Style == EStyle.Normal)
|
||||
return 1f;
|
||||
|
||||
EStyle style = CFonts.Style;
|
||||
|
||||
CFonts.Style = EStyle.Normal;
|
||||
CFonts.Height = Sizeh;
|
||||
float hStyle, hNormal;
|
||||
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
|
||||
{
|
||||
Font fo = CFonts.GetFont();
|
||||
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
|
||||
//SizeF size = g.MeasureString(chr.ToString(), fo);
|
||||
hNormal = sizeB.Height;
|
||||
}
|
||||
CFonts.Style = style;
|
||||
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
|
||||
{
|
||||
Font fo = CFonts.GetFont();
|
||||
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
|
||||
//size = g.MeasureString(chr.ToString(), fo);
|
||||
hStyle = sizeB.Height;
|
||||
}
|
||||
return hNormal / hStyle;
|
||||
}
|
||||
}
|
||||
|
||||
class CFont : IDisposable
|
||||
{
|
||||
private readonly Dictionary<char, CGlyph> _Glyphs;
|
||||
private PrivateFontCollection _Fonts;
|
||||
private FontFamily _Family;
|
||||
private readonly float _Sizeh;
|
||||
|
||||
public readonly string FilePath;
|
||||
|
||||
public CFont(string file)
|
||||
{
|
||||
FilePath = file;
|
||||
|
||||
_Glyphs = new Dictionary<char, CGlyph>();
|
||||
|
||||
switch (CConfig.TextureQuality)
|
||||
{
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST:
|
||||
_Sizeh = 25f;
|
||||
break;
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_LOW:
|
||||
_Sizeh = 50f;
|
||||
break;
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM:
|
||||
_Sizeh = 100f;
|
||||
break;
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_HIGH:
|
||||
_Sizeh = 200f;
|
||||
break;
|
||||
case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST:
|
||||
_Sizeh = 400f;
|
||||
break;
|
||||
default:
|
||||
_Sizeh = 100f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Font GetFont()
|
||||
{
|
||||
if (_Fonts == null)
|
||||
{
|
||||
_Fonts = new PrivateFontCollection();
|
||||
try
|
||||
{
|
||||
_Fonts.AddFontFile(FilePath);
|
||||
_Family = _Fonts.Families[0];
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CLog.LogError("Error opening font file " + FilePath + ": " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return new Font(_Family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color)
|
||||
{
|
||||
STexture texture;
|
||||
SRectF rect;
|
||||
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
|
||||
CDraw.DrawTexture(texture, rect, color);
|
||||
}
|
||||
|
||||
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color, float begin, float end)
|
||||
{
|
||||
STexture texture;
|
||||
SRectF rect;
|
||||
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
|
||||
CDraw.DrawTexture(texture, rect, color, begin, end);
|
||||
}
|
||||
|
||||
public void DrawGlyphReflection(char chr, float x, float y, float h, float z, SColorF color, float rspace, float rheight)
|
||||
{
|
||||
STexture texture;
|
||||
SRectF rect;
|
||||
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
|
||||
CDraw.DrawTextureReflection(texture, rect, color, rect, rspace, rheight);
|
||||
}
|
||||
|
||||
private void _GetGlyphTextureAndRect(char chr, float x, float y, float z, float h, out STexture texture, out SRectF rect)
|
||||
{
|
||||
AddGlyph(chr);
|
||||
|
||||
CFonts.Height = h;
|
||||
CGlyph glyph = _Glyphs[chr];
|
||||
texture = glyph.Texture;
|
||||
float factor = h / texture.Height;
|
||||
float width = texture.Width * factor;
|
||||
float d = glyph.Sizeh / 5f * factor;
|
||||
rect = new SRectF(x - d, y, width, h, z);
|
||||
}
|
||||
|
||||
public float GetWidth(char chr)
|
||||
{
|
||||
AddGlyph(chr);
|
||||
|
||||
CGlyph glyph = _Glyphs[chr];
|
||||
float factor = CFonts.Height / glyph.Texture.Height;
|
||||
return glyph.Width * factor;
|
||||
}
|
||||
|
||||
public float GetHeight(char chr)
|
||||
{
|
||||
return CFonts.Height;
|
||||
/*WTF???
|
||||
AddGlyph(chr);
|
||||
|
||||
CGlyph glyph = _Glyphs[chr];
|
||||
float factor = CFonts.Height / glyph.Texture.height;
|
||||
return glyph.Texture.height * factor;*/
|
||||
}
|
||||
|
||||
public void AddGlyph(char chr)
|
||||
{
|
||||
if (_Glyphs.ContainsKey(chr))
|
||||
return;
|
||||
|
||||
float h = CFonts.Height;
|
||||
_Glyphs.Add(chr, new CGlyph(chr, _Sizeh));
|
||||
CFonts.Height = h;
|
||||
}
|
||||
|
||||
public void UnloadAllGlyphs()
|
||||
{
|
||||
foreach (CGlyph glyph in _Glyphs.Values)
|
||||
glyph.UnloadTexture();
|
||||
_Glyphs.Clear();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_Fonts != null)
|
||||
{
|
||||
_Fonts.Dispose();
|
||||
_Fonts = null;
|
||||
UnloadAllGlyphs();
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
struct SFont
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public bool IsThemeFont;
|
||||
public int PartyModeID;
|
||||
public string ThemeName;
|
||||
|
||||
public string Folder;
|
||||
public string FileNormal;
|
||||
public string FileItalic;
|
||||
public string FileBold;
|
||||
public string FileBoldItalic;
|
||||
|
||||
public float Outline; //0..1, 0=not outline 1=100% outline
|
||||
public SColorF OutlineColor;
|
||||
|
||||
public CFont Normal;
|
||||
public CFont Italic;
|
||||
public CFont Bold;
|
||||
public CFont BoldItalic;
|
||||
}
|
||||
|
||||
static class CFonts
|
||||
{
|
||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
||||
@@ -328,15 +39,6 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static EStyle Style = EStyle.Normal;
|
||||
|
||||
public static int CurrentFont
|
||||
{
|
||||
get { return _CurrentFont; }
|
||||
set
|
||||
{
|
||||
if ((value >= 0) && (value < _Fonts.Count))
|
||||
_CurrentFont = value;
|
||||
}
|
||||
}
|
||||
public static float Height
|
||||
{
|
||||
get { return _Height; }
|
||||
@@ -372,7 +74,7 @@ namespace Vocaluxe.Base
|
||||
_LoadFontList();
|
||||
}
|
||||
|
||||
public static Font GetFont()
|
||||
public static System.Drawing.Font GetFont()
|
||||
{
|
||||
return _GetCurrentFont().GetFont();
|
||||
}
|
||||
@@ -504,35 +206,13 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void SetFont(string fontName)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (PartyModeID != -1)
|
||||
{
|
||||
index = _GetFontIndexParty(PartyModeID, fontName);
|
||||
|
||||
if (index >= 0 && index < _Fonts.Count)
|
||||
{
|
||||
_CurrentFont = index;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
index = _GetFontIndex(CConfig.Theme, fontName);
|
||||
|
||||
if (index >= 0 && index < _Fonts.Count)
|
||||
{
|
||||
int index = _GetPartyFontIndex(PartyModeID, fontName);
|
||||
if (index < 0)
|
||||
index = _GetThemeFontIndex(CConfig.Theme, fontName);
|
||||
if (index < 0)
|
||||
index = _GetFontIndex(fontName);
|
||||
if (index >= 0)
|
||||
_CurrentFont = index;
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _Fonts.Count; i++)
|
||||
{
|
||||
if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName)
|
||||
{
|
||||
_CurrentFont = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static RectangleF GetTextBounds(CText text)
|
||||
@@ -728,7 +408,18 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
}
|
||||
|
||||
private static int _GetFontIndex(string themeName, string fontName)
|
||||
private static int _GetFontIndex(string fontName)
|
||||
{
|
||||
for (int i = 0; i < _Fonts.Count; i++)
|
||||
{
|
||||
if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static int _GetThemeFontIndex(string themeName, string fontName)
|
||||
{
|
||||
if (themeName == "" || fontName == "")
|
||||
return -1;
|
||||
@@ -742,14 +433,14 @@ namespace Vocaluxe.Base
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static int _GetFontIndexParty(int partyModeID, string fontName)
|
||||
private static int _GetPartyFontIndex(int partyModeID, string fontName)
|
||||
{
|
||||
if (partyModeID == -1 || fontName == "")
|
||||
return -1;
|
||||
|
||||
for (int i = 0; i < _Fonts.Count; i++)
|
||||
{
|
||||
if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName && _Fonts[i].PartyModeID == partyModeID)
|
||||
if (!_Fonts[i].IsThemeFont && _Fonts[i].PartyModeID == partyModeID && _Fonts[i].Name == fontName)
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -762,7 +453,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
for (int i = 0; i < _Fonts.Count; i++)
|
||||
{
|
||||
CurrentFont = i;
|
||||
_CurrentFont = i;
|
||||
|
||||
foreach (char chr in text)
|
||||
{
|
||||
@@ -0,0 +1,143 @@
|
||||
#region license
|
||||
// /*
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Base.Font
|
||||
{
|
||||
class CGlyph
|
||||
{
|
||||
public float Sizeh { get; private set; }
|
||||
|
||||
public STexture Texture;
|
||||
public readonly int Width;
|
||||
|
||||
public CGlyph(char chr, float maxHigh)
|
||||
{
|
||||
Sizeh = maxHigh;
|
||||
|
||||
float outline = CFonts.Outline;
|
||||
const TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix;
|
||||
|
||||
float factor = _GetFactor(chr, flags);
|
||||
CFonts.Height = Sizeh * factor;
|
||||
System.Drawing.Font fo;
|
||||
Size sizeB;
|
||||
SizeF size;
|
||||
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
|
||||
{
|
||||
fo = CFonts.GetFont();
|
||||
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
|
||||
|
||||
size = g.MeasureString(chr.ToString(), fo);
|
||||
}
|
||||
|
||||
using (Bitmap bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height))
|
||||
{
|
||||
Graphics g = Graphics.FromImage(bmp);
|
||||
g.Clear(Color.Transparent);
|
||||
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
||||
CFonts.Height = Sizeh;
|
||||
fo = CFonts.GetFont();
|
||||
|
||||
PointF point = new PointF(
|
||||
outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + Sizeh / 5f,
|
||||
(sizeB.Height - size.Height - (size.Height + Sizeh / 4f) * (1f - factor)) / 2f);
|
||||
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(
|
||||
chr.ToString(),
|
||||
fo.FontFamily,
|
||||
(int)fo.Style,
|
||||
Sizeh,
|
||||
point,
|
||||
new StringFormat());
|
||||
|
||||
using (Pen pen = new Pen(
|
||||
Color.FromArgb(
|
||||
(int)CFonts.OutlineColor.A * 255,
|
||||
(int)CFonts.OutlineColor.R * 255,
|
||||
(int)CFonts.OutlineColor.G * 255,
|
||||
(int)CFonts.OutlineColor.B * 255),
|
||||
Sizeh * outline))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
g.DrawPath(pen, path);
|
||||
g.FillPath(Brushes.White, path);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
g.DrawString(
|
||||
chr.ToString(),
|
||||
fo,
|
||||
Brushes.White,
|
||||
point);
|
||||
* */
|
||||
Texture = CDraw.AddTexture(bmp);
|
||||
//bmp.Save("font/" + chr + CFonts.Style + ".png", ImageFormat.Png);
|
||||
Width = (int)((1f + outline / 2f) * sizeB.Width * Texture.Width / factor / bmp.Width);
|
||||
g.Dispose();
|
||||
}
|
||||
fo.Dispose();
|
||||
}
|
||||
|
||||
public void UnloadTexture()
|
||||
{
|
||||
CDraw.RemoveTexture(ref Texture);
|
||||
}
|
||||
|
||||
private float _GetFactor(char chr, TextFormatFlags flags)
|
||||
{
|
||||
if (CFonts.Style == EStyle.Normal)
|
||||
return 1f;
|
||||
|
||||
EStyle style = CFonts.Style;
|
||||
|
||||
CFonts.Style = EStyle.Normal;
|
||||
CFonts.Height = Sizeh;
|
||||
float hStyle, hNormal;
|
||||
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
|
||||
{
|
||||
System.Drawing.Font fo = CFonts.GetFont();
|
||||
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
|
||||
//SizeF size = g.MeasureString(chr.ToString(), fo);
|
||||
hNormal = sizeB.Height;
|
||||
}
|
||||
CFonts.Style = style;
|
||||
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
|
||||
{
|
||||
System.Drawing.Font fo = CFonts.GetFont();
|
||||
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
|
||||
//size = g.MeasureString(chr.ToString(), fo);
|
||||
hStyle = sizeB.Height;
|
||||
}
|
||||
return hNormal / hStyle;
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-205
@@ -1,4 +1,4 @@
|
||||
#region license
|
||||
#region license
|
||||
// /*
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
@@ -17,222 +17,27 @@
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Vocaluxe.Base;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
|
||||
namespace Vocaluxe.GameModes
|
||||
{
|
||||
struct SSongQueque
|
||||
{
|
||||
public readonly int SongID;
|
||||
public readonly EGameMode GameMode;
|
||||
|
||||
public SSongQueque(int songID, EGameMode gameMode)
|
||||
{
|
||||
SongID = songID;
|
||||
GameMode = gameMode;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class CGameMode : IGameMode
|
||||
{
|
||||
private List<SSongQueque> _SongQueque;
|
||||
private int _CurrentSong;
|
||||
private CPoints _Points;
|
||||
private CSong _LastSong;
|
||||
private int _LastSongID = -1;
|
||||
|
||||
#region Implementation
|
||||
public virtual void Init()
|
||||
public CSong GetSong(int songID)
|
||||
{
|
||||
_SongQueque = new List<SSongQueque>();
|
||||
Reset();
|
||||
}
|
||||
|
||||
public virtual EGameMode GetCurrentGameMode()
|
||||
{
|
||||
if (_CurrentSong >= 0 && _CurrentSong < _SongQueque.Count)
|
||||
return _SongQueque[_CurrentSong].GameMode;
|
||||
return EGameMode.TR_GAMEMODE_NORMAL;
|
||||
}
|
||||
|
||||
public virtual bool AddVisibleSong(int visibleIndex, EGameMode gameMode)
|
||||
{
|
||||
if (CSongs.VisibleSongs.Length > visibleIndex)
|
||||
if (songID != _LastSongID)
|
||||
{
|
||||
int songID = CSongs.VisibleSongs[visibleIndex].ID;
|
||||
if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet)
|
||||
return false;
|
||||
|
||||
_SongQueque.Add(new SSongQueque(songID, gameMode));
|
||||
return true;
|
||||
CSong song = CSongs.GetSong(songID);
|
||||
_LastSong = _PrepareSong(song);
|
||||
_LastSongID = songID;
|
||||
}
|
||||
return false;
|
||||
return _LastSong;
|
||||
}
|
||||
|
||||
public virtual bool AddSong(int absoluteIndex, EGameMode gameMode)
|
||||
{
|
||||
if (CSongs.AllSongs.Length > absoluteIndex)
|
||||
{
|
||||
int songID = CSongs.AllSongs[absoluteIndex].ID;
|
||||
if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet)
|
||||
return false;
|
||||
|
||||
_SongQueque.Add(new SSongQueque(songID, gameMode));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool RemoveVisibleSong(int visibleIndex)
|
||||
{
|
||||
if (CSongs.VisibleSongs.Length > visibleIndex)
|
||||
{
|
||||
int index = -1;
|
||||
int songID = CSongs.VisibleSongs[visibleIndex].ID;
|
||||
for (int i = 0; i < _SongQueque.Count; i++)
|
||||
{
|
||||
if (_SongQueque[i].SongID == songID)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index == -1)
|
||||
return false;
|
||||
|
||||
_SongQueque.RemoveAt(index);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool RemoveSong(int absoluteIndex)
|
||||
{
|
||||
if (CSongs.AllSongs.Length > absoluteIndex)
|
||||
{
|
||||
int index = -1;
|
||||
int songID = CSongs.AllSongs[absoluteIndex].ID;
|
||||
for (int i = 0; i < _SongQueque.Count; i++)
|
||||
{
|
||||
if (_SongQueque[i].SongID == songID)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1)
|
||||
return false;
|
||||
|
||||
_SongQueque.RemoveAt(index);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void ClearSongs()
|
||||
{
|
||||
_SongQueque.Clear();
|
||||
}
|
||||
|
||||
public virtual void Reset()
|
||||
{
|
||||
_CurrentSong = -1;
|
||||
}
|
||||
|
||||
public virtual void Start(SPlayer[] player)
|
||||
{
|
||||
_Points = new CPoints(_SongQueque.Count, player);
|
||||
}
|
||||
|
||||
public virtual void NextRound(SPlayer[] player)
|
||||
{
|
||||
if (_CurrentSong < _SongQueque.Count && _SongQueque.Count > 0)
|
||||
{
|
||||
if (_CurrentSong > -1)
|
||||
{
|
||||
_Points.SetPoints(
|
||||
_CurrentSong,
|
||||
_SongQueque[_CurrentSong].SongID,
|
||||
player,
|
||||
_SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_MEDLEY,
|
||||
_SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_DUET,
|
||||
_SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_SHORTSONG);
|
||||
}
|
||||
_CurrentSong++;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsFinished()
|
||||
{
|
||||
return _CurrentSong == _SongQueque.Count || _SongQueque.Count == 0;
|
||||
}
|
||||
|
||||
public virtual int GetCurrentRoundNr()
|
||||
{
|
||||
return _CurrentSong + 1;
|
||||
}
|
||||
|
||||
public virtual CSong GetSong()
|
||||
{
|
||||
if (_CurrentSong >= 0 && _CurrentSong < _SongQueque.Count)
|
||||
{
|
||||
CSong song = CSongs.GetSong(_SongQueque[_CurrentSong].SongID);
|
||||
song = new CSong(song);
|
||||
|
||||
switch (GetCurrentGameMode())
|
||||
{
|
||||
case EGameMode.TR_GAMEMODE_MEDLEY:
|
||||
// set medley mode timings
|
||||
song.Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap;
|
||||
if (song.Start < 0f)
|
||||
song.Start = 0f;
|
||||
|
||||
song.Finish = CGame.GetTimeFromBeats(song.Medley.EndBeat, song.BPM) + song.Medley.FadeOutTime + song.Gap;
|
||||
|
||||
// set lines to medley mode
|
||||
song.Notes.SetMedley(song.Medley.StartBeat, song.Medley.EndBeat);
|
||||
break;
|
||||
|
||||
case EGameMode.TR_GAMEMODE_SHORTSONG:
|
||||
song.Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap;
|
||||
|
||||
// set lines to medley mode
|
||||
song.Notes.SetMedley(song.Notes.GetVoice(0).Lines[0].FirstNoteBeat, song.ShortEnd);
|
||||
break;
|
||||
}
|
||||
|
||||
return song;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual int GetNumSongs()
|
||||
{
|
||||
return _SongQueque.Count;
|
||||
}
|
||||
|
||||
public virtual CSong GetSong(int num)
|
||||
{
|
||||
if (num - 1 < _SongQueque.Count && num - 1 > -1)
|
||||
return CSongs.GetSong(_SongQueque[num - 1].SongID);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual EGameMode GetGameMode(int num)
|
||||
{
|
||||
if (num - 1 < _SongQueque.Count && num > -1)
|
||||
return _SongQueque[num].GameMode;
|
||||
|
||||
return EGameMode.TR_GAMEMODE_NORMAL;
|
||||
}
|
||||
|
||||
public virtual CPoints GetPoints()
|
||||
{
|
||||
return _Points;
|
||||
}
|
||||
#endregion Implementation
|
||||
protected abstract CSong _PrepareSong(CSong song);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
#region license
|
||||
// /*
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Vocaluxe.Base;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
|
||||
namespace Vocaluxe.GameModes
|
||||
{
|
||||
static class CGameModes
|
||||
{
|
||||
private static Dictionary<EGameMode, IGameMode> _GameModes;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_GameModes = new Dictionary<EGameMode, IGameMode>
|
||||
{
|
||||
{EGameMode.TR_GAMEMODE_NORMAL, new CGameModeNormal()},
|
||||
{EGameMode.TR_GAMEMODE_DUET, new CGameModeDuet()},
|
||||
{EGameMode.TR_GAMEMODE_SHORTSONG, new CGameModeShort()},
|
||||
{EGameMode.TR_GAMEMODE_MEDLEY, new CGameModeMedley()}
|
||||
};
|
||||
}
|
||||
|
||||
public static IGameMode Get(EGameMode gameMode)
|
||||
{
|
||||
if (_GameModes == null)
|
||||
return null;
|
||||
IGameMode result;
|
||||
if (!_GameModes.TryGetValue(gameMode, out result))
|
||||
result = _GameModes[EGameMode.TR_GAMEMODE_NORMAL];
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
class CGameModeNormal : CGameMode
|
||||
{
|
||||
protected override CSong _PrepareSong(CSong song)
|
||||
{
|
||||
return song;
|
||||
}
|
||||
}
|
||||
|
||||
class CGameModeDuet : CGameMode
|
||||
{
|
||||
protected override CSong _PrepareSong(CSong song)
|
||||
{
|
||||
return (song.IsDuet) ? song : null;
|
||||
}
|
||||
}
|
||||
|
||||
class CGameModeShort : CGameMode
|
||||
{
|
||||
protected override CSong _PrepareSong(CSong song)
|
||||
{
|
||||
CSong newSong = new CSong(song) {Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap};
|
||||
// set lines to short mode
|
||||
newSong.Notes.SetMedley(song.Notes.GetVoice(0).Lines[0].FirstNoteBeat, song.ShortEnd);
|
||||
|
||||
return newSong;
|
||||
}
|
||||
}
|
||||
|
||||
class CGameModeMedley : CGameMode
|
||||
{
|
||||
protected override CSong _PrepareSong(CSong song)
|
||||
{
|
||||
CSong newSong = new CSong(song) {Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap};
|
||||
if (newSong.Start < 0f)
|
||||
newSong.Start = 0f;
|
||||
|
||||
newSong.Finish = CGame.GetTimeFromBeats(song.Medley.EndBeat, song.BPM) + song.Medley.FadeOutTime + song.Gap;
|
||||
|
||||
// set lines to medley mode
|
||||
newSong.Notes.SetMedley(song.Medley.StartBeat, song.Medley.EndBeat);
|
||||
|
||||
return newSong;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,34 +17,12 @@
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
|
||||
namespace Vocaluxe.GameModes
|
||||
{
|
||||
interface IGameMode
|
||||
{
|
||||
void Init();
|
||||
|
||||
EGameMode GetCurrentGameMode();
|
||||
|
||||
bool AddVisibleSong(int visibleIndex, EGameMode gameMode);
|
||||
bool AddSong(int absoluteIndex, EGameMode gameMode);
|
||||
bool RemoveVisibleSong(int visibleIndex);
|
||||
bool RemoveSong(int absoluteIndex);
|
||||
void ClearSongs();
|
||||
|
||||
void Reset();
|
||||
void Start(SPlayer[] player);
|
||||
void NextRound(SPlayer[] player);
|
||||
bool IsFinished();
|
||||
int GetCurrentRoundNr();
|
||||
|
||||
CPoints GetPoints();
|
||||
|
||||
int GetNumSongs();
|
||||
CSong GetSong();
|
||||
CSong GetSong(int num);
|
||||
EGameMode GetGameMode(int num);
|
||||
CSong GetSong(int songID);
|
||||
}
|
||||
}
|
||||
@@ -29,12 +29,14 @@ using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using SlimDX.Windows;
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Base.Font;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
class CDirect3D : Form, IDraw
|
||||
class CDirect3D : RenderForm, IDraw
|
||||
{
|
||||
#region private vars
|
||||
private readonly CKeys _Keys;
|
||||
@@ -51,7 +53,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
private readonly Dictionary<int, STexture> _Textures;
|
||||
private readonly Dictionary<int, Texture> _D3DTextures;
|
||||
private readonly List<STextureQueque> _Queque;
|
||||
private readonly List<STextureQueue> _Queue;
|
||||
private readonly Queue<int> _IDs;
|
||||
|
||||
private readonly Object _MutexTexture = new Object();
|
||||
@@ -81,7 +83,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon));
|
||||
_Textures = new Dictionary<int, STexture>();
|
||||
_D3DTextures = new Dictionary<int, Texture>();
|
||||
_Queque = new List<STextureQueque>();
|
||||
_Queue = new List<STextureQueue>();
|
||||
_IDs = new Queue<int>();
|
||||
|
||||
//Fill Queue with 100000 IDs
|
||||
@@ -97,7 +99,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
_D3D = new Direct3D();
|
||||
}
|
||||
catch (Direct3D9NotFoundException e)
|
||||
catch (Direct3DX9NotFoundException e)
|
||||
{
|
||||
MessageBox.Show("No DirectX runtimes were found, please download and install them " +
|
||||
"from http://www.microsoft.com/download/en/details.aspx?id=8109",
|
||||
@@ -515,13 +517,15 @@ namespace Vocaluxe.Lib.Draw
|
||||
//We want to begin drawing
|
||||
if (_Device.BeginScene().IsFailure)
|
||||
CLog.LogError("Failed to begin scene");
|
||||
_CheckQueque();
|
||||
_Run = _Run && CGraphics.Draw();
|
||||
_CheckQueue();
|
||||
if (!CGraphics.Draw())
|
||||
_Run = false;
|
||||
_RenderVertexBuffer();
|
||||
//We finished drawing the frame
|
||||
if (_Device.EndScene().IsFailure)
|
||||
CLog.LogError("Failed to end scene");
|
||||
_Run = CGraphics.UpdateGameLogic(_Keys, _Mouse);
|
||||
if (!CGraphics.UpdateGameLogic(_Keys, _Mouse))
|
||||
_Run = false;
|
||||
try
|
||||
{
|
||||
//Now push the frame to the Viewport
|
||||
@@ -578,6 +582,11 @@ namespace Vocaluxe.Lib.Draw
|
||||
/// <returns></returns>
|
||||
public bool Unload()
|
||||
{
|
||||
try
|
||||
{
|
||||
Close();
|
||||
}
|
||||
catch {}
|
||||
//Dispose all textures
|
||||
foreach (KeyValuePair<int, Texture> p in _D3DTextures)
|
||||
{
|
||||
@@ -1010,10 +1019,10 @@ namespace Vocaluxe.Lib.Draw
|
||||
return t;
|
||||
}
|
||||
|
||||
public STexture QuequeTexture(int w, int h, ref byte[] data)
|
||||
public STexture EnqueueTexture(int w, int h, ref byte[] data)
|
||||
{
|
||||
STexture texture = new STexture(-1);
|
||||
STextureQueque queque = new STextureQueque {Data = data, Height = h, Width = w};
|
||||
STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w};
|
||||
|
||||
texture.Height = h;
|
||||
texture.Width = w;
|
||||
@@ -1022,8 +1031,8 @@ namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
_D3DTextures.Add(_IDs.Peek(), null);
|
||||
texture.Index = _IDs.Dequeue();
|
||||
queque.ID = texture.Index;
|
||||
_Queque.Add(queque);
|
||||
queue.ID = texture.Index;
|
||||
_Queue.Add(queue);
|
||||
_Textures[texture.Index] = texture;
|
||||
}
|
||||
return texture;
|
||||
@@ -1405,14 +1414,14 @@ namespace Vocaluxe.Lib.Draw
|
||||
}
|
||||
#endregion drawing
|
||||
|
||||
private void _CheckQueque()
|
||||
private void _CheckQueue()
|
||||
{
|
||||
lock (_MutexTexture)
|
||||
{
|
||||
if (_Queque.Count == 0)
|
||||
if (_Queue.Count == 0)
|
||||
return;
|
||||
|
||||
STextureQueque q = _Queque[0];
|
||||
STextureQueue q = _Queue[0];
|
||||
STexture texture;
|
||||
if (_Textures.ContainsKey(q.ID))
|
||||
texture = _Textures[q.ID];
|
||||
@@ -1423,7 +1432,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
_D3DTextures[q.ID] = t;
|
||||
|
||||
_Textures[texture.Index] = texture;
|
||||
_Queque.RemoveAt(0);
|
||||
_Queue.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Base.Font;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Lib.Draw
|
||||
@@ -266,6 +267,11 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
public bool Unload()
|
||||
{
|
||||
try
|
||||
{
|
||||
Close();
|
||||
}
|
||||
catch {}
|
||||
Dispose();
|
||||
return true;
|
||||
}
|
||||
@@ -418,7 +424,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
return new STexture(-1);
|
||||
}
|
||||
|
||||
public STexture QuequeTexture(int w, int h, ref byte[] data)
|
||||
public STexture EnqueueTexture(int w, int h, ref byte[] data)
|
||||
{
|
||||
return AddTexture(w, h, ref data);
|
||||
}
|
||||
|
||||
+257
-271
@@ -18,6 +18,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Threading;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
@@ -25,12 +26,33 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Base.Font;
|
||||
using VocaluxeLib.Menu;
|
||||
using BeginMode = OpenTK.Graphics.OpenGL.BeginMode;
|
||||
using BlendingFactorDest = OpenTK.Graphics.OpenGL.BlendingFactorDest;
|
||||
using BlendingFactorSrc = OpenTK.Graphics.OpenGL.BlendingFactorSrc;
|
||||
using BufferAccess = OpenTK.Graphics.OpenGL.BufferAccess;
|
||||
using BufferTarget = OpenTK.Graphics.OpenGL.BufferTarget;
|
||||
using BufferUsageHint = OpenTK.Graphics.OpenGL.BufferUsageHint;
|
||||
using ClearBufferMask = OpenTK.Graphics.OpenGL.ClearBufferMask;
|
||||
using DepthFunction = OpenTK.Graphics.OpenGL.DepthFunction;
|
||||
using EnableCap = OpenTK.Graphics.OpenGL.EnableCap;
|
||||
using GL = OpenTK.Graphics.OpenGL.GL;
|
||||
using GenerateMipmapTarget = OpenTK.Graphics.OpenGL.GenerateMipmapTarget;
|
||||
using KeyPressEventArgs = System.Windows.Forms.KeyPressEventArgs;
|
||||
using MatrixMode = OpenTK.Graphics.OpenGL.MatrixMode;
|
||||
using PixelFormat = OpenTK.Graphics.OpenGL.PixelFormat;
|
||||
using PixelInternalFormat = OpenTK.Graphics.OpenGL.PixelInternalFormat;
|
||||
using PixelStoreParameter = OpenTK.Graphics.OpenGL.PixelStoreParameter;
|
||||
using PixelType = OpenTK.Graphics.OpenGL.PixelType;
|
||||
using TextureMagFilter = OpenTK.Graphics.OpenGL.TextureMagFilter;
|
||||
using TextureMinFilter = OpenTK.Graphics.OpenGL.TextureMinFilter;
|
||||
using TextureParameterName = OpenTK.Graphics.OpenGL.TextureParameterName;
|
||||
using TextureTarget = OpenTK.Graphics.OpenGL.TextureTarget;
|
||||
|
||||
namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
@@ -41,7 +63,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
public int Height;
|
||||
};
|
||||
|
||||
struct STextureQueque
|
||||
struct STextureQueue
|
||||
{
|
||||
public int ID;
|
||||
public int Width;
|
||||
@@ -63,7 +85,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
private readonly Dictionary<int, STexture> _Textures;
|
||||
private readonly Queue<int> _IDs;
|
||||
private readonly List<STextureQueque> _Queque;
|
||||
private readonly List<STextureQueue> _Queue;
|
||||
|
||||
private readonly Object _MutexTexture = new Object();
|
||||
|
||||
@@ -80,7 +102,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon));
|
||||
|
||||
_Textures = new Dictionary<int, STexture>();
|
||||
_Queque = new List<STextureQueque>();
|
||||
_Queue = new List<STextureQueue>();
|
||||
_IDs = new Queue<int>(1000000);
|
||||
|
||||
for (int i = 1; i < 1000000; i++)
|
||||
@@ -88,12 +110,11 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
//Check AA Mode
|
||||
CConfig.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.AAMode);
|
||||
CConfig.ColorDepth = (EColorDepth)_CheckColorDepth((int)CConfig.ColorDepth);
|
||||
|
||||
bool ok = false;
|
||||
try
|
||||
{
|
||||
GraphicsMode gm = new GraphicsMode((int)CConfig.ColorDepth, 24, 0, (int)CConfig.AAMode);
|
||||
GraphicsMode gm = new GraphicsMode(32, 24, 0, (int)CConfig.AAMode);
|
||||
_Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default);
|
||||
if (_Control.GraphicsMode != null)
|
||||
ok = true;
|
||||
@@ -220,8 +241,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
screenNr = i;
|
||||
}
|
||||
|
||||
DesktopBounds = new Rectangle(Screen.AllScreens[screenNr].Bounds.Location,
|
||||
new Size(Screen.AllScreens[screenNr].Bounds.Width, Screen.AllScreens[screenNr].Bounds.Height));
|
||||
DesktopBounds = new Rectangle(Screen.AllScreens[screenNr].Bounds.Location, new Size(Screen.AllScreens[screenNr].Bounds.Width, Screen.AllScreens[screenNr].Bounds.Height));
|
||||
|
||||
if (WindowState == FormWindowState.Maximized)
|
||||
{
|
||||
@@ -259,7 +279,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.ClearColor(Color.Black);
|
||||
GL.ClearColor(Color.Black);
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
@@ -337,7 +357,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
_Keys.KeyDown(e);
|
||||
}
|
||||
|
||||
private void _OnKeyPressEvent(object sender, System.Windows.Forms.KeyPressEventArgs e)
|
||||
private void _OnKeyPressEvent(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
_Keys.KeyPress(e);
|
||||
}
|
||||
@@ -367,10 +387,10 @@ namespace Vocaluxe.Lib.Draw
|
||||
_Y = (_Control.Height - _H) / 2;
|
||||
}
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Projection);
|
||||
OpenTK.Graphics.OpenGL.GL.LoadIdentity();
|
||||
OpenTK.Graphics.OpenGL.GL.Ortho(0, CSettings.RenderW, CSettings.RenderH, 0, CSettings.ZNear, CSettings.ZFar);
|
||||
OpenTK.Graphics.OpenGL.GL.Viewport(_X, _Y, _W, _H);
|
||||
GL.MatrixMode(MatrixMode.Projection);
|
||||
GL.LoadIdentity();
|
||||
GL.Ortho(0, CSettings.RenderW, CSettings.RenderH, 0, CSettings.ZNear, CSettings.ZFar);
|
||||
GL.Viewport(_X, _Y, _W, _H);
|
||||
}
|
||||
|
||||
#region implementation
|
||||
@@ -381,14 +401,14 @@ namespace Vocaluxe.Lib.Draw
|
||||
Text = CSettings.GetFullVersionText();
|
||||
|
||||
// Init Texturing
|
||||
OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Texture2D);
|
||||
GL.Enable(EnableCap.Texture2D);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BlendFunc(OpenTK.Graphics.OpenGL.BlendingFactorSrc.SrcAlpha, OpenTK.Graphics.OpenGL.BlendingFactorDest.OneMinusSrcAlpha);
|
||||
OpenTK.Graphics.OpenGL.GL.PixelStore(OpenTK.Graphics.OpenGL.PixelStoreParameter.UnpackAlignment, 1);
|
||||
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
|
||||
GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.DepthRange(CSettings.ZFar, CSettings.ZNear);
|
||||
OpenTK.Graphics.OpenGL.GL.DepthFunc(OpenTK.Graphics.OpenGL.DepthFunction.Lequal);
|
||||
OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.DepthTest);
|
||||
GL.DepthRange(CSettings.ZFar, CSettings.ZNear);
|
||||
GL.DepthFunc(DepthFunction.Lequal);
|
||||
GL.Enable(EnableCap.DepthTest);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -412,15 +432,17 @@ namespace Vocaluxe.Lib.Draw
|
||||
if (_Run)
|
||||
{
|
||||
ClearScreen();
|
||||
_Run = _Run && CGraphics.Draw();
|
||||
if (!CGraphics.Draw())
|
||||
_Run = false;
|
||||
if (!CGraphics.UpdateGameLogic(_Keys, _Mouse))
|
||||
_Run = false;
|
||||
|
||||
_Run = CGraphics.UpdateGameLogic(_Keys, _Mouse);
|
||||
_Control.SwapBuffers();
|
||||
|
||||
if ((CSettings.IsFullScreen && !_Fullscreen) || (!CSettings.IsFullScreen && _Fullscreen))
|
||||
_ToggleFullScreen();
|
||||
|
||||
_CheckQueque();
|
||||
_CheckQueue();
|
||||
|
||||
if (CTime.IsRunning())
|
||||
delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds());
|
||||
@@ -437,6 +459,11 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
public bool Unload()
|
||||
{
|
||||
try
|
||||
{
|
||||
Close();
|
||||
}
|
||||
catch {}
|
||||
STexture[] textures = new STexture[_Textures.Count];
|
||||
_Textures.Values.CopyTo(textures, 0);
|
||||
for (int i = 0; i < _Textures.Count; i++)
|
||||
@@ -472,15 +499,15 @@ namespace Vocaluxe.Lib.Draw
|
||||
#region Basic Draw Methods
|
||||
public void ClearScreen()
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit | OpenTK.Graphics.OpenGL.ClearBufferMask.DepthBufferBit);
|
||||
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
}
|
||||
|
||||
public STexture CopyScreen()
|
||||
{
|
||||
STexture texture = new STexture(-1);
|
||||
|
||||
int id = OpenTK.Graphics.OpenGL.GL.GenTexture();
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id);
|
||||
int id = GL.GenTexture();
|
||||
GL.BindTexture(TextureTarget.Texture2D, id);
|
||||
texture.ID = id;
|
||||
|
||||
texture.Width = _W;
|
||||
@@ -491,19 +518,14 @@ namespace Vocaluxe.Lib.Draw
|
||||
texture.WidthRatio = texture.Width / texture.W2;
|
||||
texture.HeightRatio = texture.Height / texture.H2;
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2,
|
||||
(int)texture.H2, 0,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero);
|
||||
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.W2, (int)texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.CopyTexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, _X, _Y,
|
||||
(int)texture.Width, (int)texture.Height);
|
||||
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, _X, _Y, (int)texture.Width, (int)texture.Height);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMagFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMagFilter.Linear);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
|
||||
// Add to Texture List
|
||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
||||
@@ -527,12 +549,11 @@ namespace Vocaluxe.Lib.Draw
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
|
||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.CopyTexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, 0, 0,
|
||||
(int)texture.Width, (int)texture.Height);
|
||||
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, (int)texture.Width, (int)texture.Height);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,7 +573,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
BitmapData bmpData = screen.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, bmpData.Scan0);
|
||||
GL.ReadPixels(0, 0, width, height, PixelFormat.Bgra, PixelType.UnsignedByte, bmpData.Scan0);
|
||||
screen.UnlockBits(bmpData);
|
||||
|
||||
screen.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
@@ -570,17 +591,17 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
public void DrawColor(SColorF color, SRectF rect)
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
GL.Enable(EnableCap.Blend);
|
||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Begin(OpenTK.Graphics.OpenGL.BeginMode.Quads);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X, rect.Y, rect.Z + CGraphics.ZOffset);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + rect.W, rect.Y, rect.Z + CGraphics.ZOffset);
|
||||
OpenTK.Graphics.OpenGL.GL.End();
|
||||
GL.Begin(BeginMode.Quads);
|
||||
GL.Vertex3(rect.X, rect.Y, rect.Z + CGraphics.ZOffset);
|
||||
GL.Vertex3(rect.X, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
|
||||
GL.Vertex3(rect.X + rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
|
||||
GL.Vertex3(rect.X + rect.W, rect.Y, rect.Z + CGraphics.ZOffset);
|
||||
GL.End();
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Disable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
GL.Disable(EnableCap.Blend);
|
||||
}
|
||||
|
||||
public void DrawColorReflection(SColorF color, SRectF rect, float space, float height)
|
||||
@@ -606,32 +627,32 @@ namespace Vocaluxe.Lib.Draw
|
||||
ry2 = rect.Y + rect.H + space + height;
|
||||
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
GL.Enable(EnableCap.Blend);
|
||||
|
||||
if (Math.Abs(rect.Rotation) > 0.001)
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0);
|
||||
OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
|
||||
OpenTK.Graphics.OpenGL.GL.Translate(-0.5f, -0.5f, 0);
|
||||
GL.Translate(0.5f, 0.5f, 0);
|
||||
GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
|
||||
GL.Translate(-0.5f, -0.5f, 0);
|
||||
}
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Begin(OpenTK.Graphics.OpenGL.BeginMode.Quads);
|
||||
GL.Begin(BeginMode.Quads);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, 0f);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||
GL.Color4(color.R, color.G, color.B, 0f);
|
||||
GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, 0f);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||
GL.Color4(color.R, color.G, color.B, 0f);
|
||||
GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.End();
|
||||
GL.End();
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Disable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
GL.Disable(EnableCap.Blend);
|
||||
}
|
||||
#endregion Basic Draw Methods
|
||||
|
||||
@@ -710,8 +731,8 @@ namespace Vocaluxe.Lib.Draw
|
||||
h = maxSize;
|
||||
}
|
||||
|
||||
int id = OpenTK.Graphics.OpenGL.GL.GenTexture();
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id);
|
||||
int id = GL.GenTexture();
|
||||
GL.BindTexture(TextureTarget.Texture2D, id);
|
||||
texture.ID = id;
|
||||
|
||||
texture.Width = w;
|
||||
@@ -719,45 +740,41 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
texture.W2 = MathHelper.NextPowerOfTwo(w);
|
||||
texture.H2 = MathHelper.NextPowerOfTwo(h);
|
||||
|
||||
using (Bitmap bmp2 = new Bitmap((int)texture.W2, (int)texture.H2))
|
||||
try
|
||||
{
|
||||
Graphics g = Graphics.FromImage(bmp2);
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||
g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height));
|
||||
g.Dispose();
|
||||
using (Bitmap bmp2 = new Bitmap((int)texture.W2, (int)texture.H2))
|
||||
{
|
||||
Graphics g = Graphics.FromImage(bmp2);
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||
g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height));
|
||||
g.Dispose();
|
||||
|
||||
texture.WidthRatio = 1f;
|
||||
texture.HeightRatio = 1f;
|
||||
texture.WidthRatio = 1f;
|
||||
texture.HeightRatio = 1f;
|
||||
|
||||
BitmapData bmpData = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
BitmapData bmpData = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
|
||||
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.W2, (int)texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2,
|
||||
(int)texture.H2, 0,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero);
|
||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bmpData.Width, bmpData.Height, PixelFormat.Bgra, PixelType.UnsignedByte, bmpData.Scan0);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, bmpData.Width, bmpData.Height,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, bmpData.Scan0);
|
||||
|
||||
bmp2.UnlockBits(bmpData);
|
||||
bmp2.UnlockBits(bmpData);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
CLog.LogError(w + " " + h + " " + (int)texture.W2 + " " + (int)texture.H2);
|
||||
throw;
|
||||
}
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureWrapS,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureParameterName.ClampToEdge);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureWrapT,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureParameterName.ClampToEdge);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMagFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMagFilter.Linear);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.Linear);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.LinearMipmapLinear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
|
||||
//GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
OpenTK.Graphics.OpenGL.GL.Ext.GenerateMipmap(OpenTK.Graphics.OpenGL.GenerateMipmapTarget.Texture2D);
|
||||
GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
|
||||
|
||||
// Add to Texture List
|
||||
@@ -782,11 +799,10 @@ namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.GenBuffers(1, out texture.PBO);
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
OpenTK.Graphics.OpenGL.GL.BufferData(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, (IntPtr)(w * h * 4), IntPtr.Zero,
|
||||
OpenTK.Graphics.OpenGL.BufferUsageHint.StreamDraw);
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0);
|
||||
GL.GenBuffers(1, out texture.PBO);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
GL.BufferData(BufferTarget.PixelUnpackBuffer, (IntPtr)(w * h * 4), IntPtr.Zero, BufferUsageHint.StreamDraw);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -794,8 +810,8 @@ namespace Vocaluxe.Lib.Draw
|
||||
}
|
||||
}
|
||||
|
||||
int id = OpenTK.Graphics.OpenGL.GL.GenTexture();
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id);
|
||||
int id = GL.GenTexture();
|
||||
GL.BindTexture(TextureTarget.Texture2D, id);
|
||||
texture.ID = id;
|
||||
|
||||
texture.Width = w;
|
||||
@@ -806,25 +822,20 @@ namespace Vocaluxe.Lib.Draw
|
||||
texture.WidthRatio = texture.Width / texture.W2;
|
||||
texture.HeightRatio = texture.Height / texture.H2;
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2,
|
||||
(int)texture.H2, 0,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero);
|
||||
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.W2, (int)texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, w, h,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, data);
|
||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, w, h, PixelFormat.Bgra, PixelType.UnsignedByte, data);
|
||||
|
||||
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMagFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMagFilter.Linear);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
|
||||
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
|
||||
//GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
//GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
|
||||
// Add to Texture List
|
||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
||||
@@ -848,11 +859,10 @@ namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.GenBuffers(1, out texture.PBO);
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
OpenTK.Graphics.OpenGL.GL.BufferData(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, (IntPtr)data.Length, IntPtr.Zero,
|
||||
OpenTK.Graphics.OpenGL.BufferUsageHint.StreamDraw);
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0);
|
||||
GL.GenBuffers(1, out texture.PBO);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
GL.BufferData(BufferTarget.PixelUnpackBuffer, (IntPtr)data.Length, IntPtr.Zero, BufferUsageHint.StreamDraw);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -861,8 +871,8 @@ namespace Vocaluxe.Lib.Draw
|
||||
}
|
||||
}
|
||||
|
||||
int id = OpenTK.Graphics.OpenGL.GL.GenTexture();
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id);
|
||||
int id = GL.GenTexture();
|
||||
GL.BindTexture(TextureTarget.Texture2D, id);
|
||||
texture.ID = id;
|
||||
|
||||
texture.Width = w;
|
||||
@@ -873,25 +883,20 @@ namespace Vocaluxe.Lib.Draw
|
||||
texture.WidthRatio = texture.Width / texture.W2;
|
||||
texture.HeightRatio = texture.Height / texture.H2;
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2,
|
||||
(int)texture.H2, 0,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero);
|
||||
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.W2, (int)texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, w, h,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, data);
|
||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, w, h, PixelFormat.Bgra, PixelType.UnsignedByte, data);
|
||||
|
||||
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMagFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMagFilter.Linear);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
|
||||
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
|
||||
//GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
//GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
|
||||
// Add to Texture List
|
||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
||||
@@ -907,10 +912,10 @@ namespace Vocaluxe.Lib.Draw
|
||||
return texture;
|
||||
}
|
||||
|
||||
public STexture QuequeTexture(int w, int h, ref byte[] data)
|
||||
public STexture EnqueueTexture(int w, int h, ref byte[] data)
|
||||
{
|
||||
STexture texture = new STexture(-1);
|
||||
STextureQueque queque = new STextureQueque {Data = data, Height = h, Width = w};
|
||||
STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w};
|
||||
|
||||
texture.Height = h;
|
||||
texture.Width = w;
|
||||
@@ -918,8 +923,8 @@ namespace Vocaluxe.Lib.Draw
|
||||
lock (_MutexTexture)
|
||||
{
|
||||
texture.Index = _IDs.Dequeue();
|
||||
queque.ID = texture.Index;
|
||||
_Queque.Add(queque);
|
||||
queue.ID = texture.Index;
|
||||
_Queue.Add(queue);
|
||||
_Textures[texture.Index] = texture;
|
||||
}
|
||||
|
||||
@@ -936,22 +941,21 @@ namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
|
||||
IntPtr buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly);
|
||||
IntPtr buffer = GL.MapBuffer(BufferTarget.PixelUnpackBuffer, BufferAccess.WriteOnly);
|
||||
byte[] d = new byte[(int)texture.Height * (int)texture.Width * 4];
|
||||
|
||||
Marshal.Copy(data, d, 0, (int)texture.Height * (int)texture.Width * 4);
|
||||
Marshal.Copy(d, 0, buffer, (int)texture.Height * (int)texture.Width * 4);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.UnmapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer);
|
||||
GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
|
||||
OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero);
|
||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -961,26 +965,21 @@ namespace Vocaluxe.Lib.Draw
|
||||
}
|
||||
}
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
|
||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, data);
|
||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureWrapS,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureParameterName.ClampToEdge);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureWrapT,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureParameterName.ClampToEdge);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
|
||||
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.LinearMipmapLinear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
|
||||
//GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
OpenTK.Graphics.OpenGL.GL.Ext.GenerateMipmap(OpenTK.Graphics.OpenGL.GenerateMipmapTarget.Texture2D);
|
||||
GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -993,39 +992,35 @@ namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
if (_UsePBO)
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
|
||||
IntPtr buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly);
|
||||
IntPtr buffer = GL.MapBuffer(BufferTarget.PixelUnpackBuffer, BufferAccess.WriteOnly);
|
||||
Marshal.Copy(data, 0, buffer, data.Length);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.UnmapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer);
|
||||
GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
|
||||
OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero);
|
||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
|
||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, data);
|
||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
|
||||
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMagFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMagFilter.Linear);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
|
||||
|
||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
|
||||
//GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
//GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1040,9 +1035,9 @@ namespace Vocaluxe.Lib.Draw
|
||||
lock (_MutexTexture)
|
||||
{
|
||||
_IDs.Enqueue(texture.Index);
|
||||
OpenTK.Graphics.OpenGL.GL.DeleteTexture(texture.ID);
|
||||
GL.DeleteTexture(texture.ID);
|
||||
if (texture.PBO > 0)
|
||||
OpenTK.Graphics.OpenGL.GL.DeleteBuffers(1, ref texture.PBO);
|
||||
GL.DeleteBuffers(1, ref texture.PBO);
|
||||
_Textures.Remove(texture.Index);
|
||||
texture.Index = -1;
|
||||
texture.ID = -1;
|
||||
@@ -1106,7 +1101,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
if (_TextureExists(ref texture))
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
|
||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||
|
||||
float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio;
|
||||
float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio;
|
||||
@@ -1143,60 +1138,60 @@ namespace Vocaluxe.Lib.Draw
|
||||
if (ry2 > bounds.Y + bounds.H)
|
||||
ry2 = bounds.Y + bounds.H;
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
GL.Enable(EnableCap.Blend);
|
||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Texture);
|
||||
OpenTK.Graphics.OpenGL.GL.PushMatrix();
|
||||
GL.MatrixMode(MatrixMode.Texture);
|
||||
GL.PushMatrix();
|
||||
|
||||
if (Math.Abs(rect.Rotation) > float.Epsilon)
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0);
|
||||
OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
|
||||
OpenTK.Graphics.OpenGL.GL.Translate(-0.5f, -0.5f, 0);
|
||||
GL.Translate(0.5f, 0.5f, 0);
|
||||
GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
|
||||
GL.Translate(-0.5f, -0.5f, 0);
|
||||
}
|
||||
|
||||
if (!mirrored)
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.Begin(OpenTK.Graphics.OpenGL.BeginMode.Quads);
|
||||
GL.Begin(BeginMode.Quads);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x1, y1);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(x1, y1);
|
||||
GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x1, y2);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(x1, y2);
|
||||
GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x2, y2);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(x2, y2);
|
||||
GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x2, y1);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(x2, y1);
|
||||
GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.End();
|
||||
GL.End();
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.Begin(OpenTK.Graphics.OpenGL.BeginMode.Quads);
|
||||
GL.Begin(BeginMode.Quads);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x2, y2);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(x2, y2);
|
||||
GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x2, y1);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(x2, y1);
|
||||
GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x1, y1);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(x1, y1);
|
||||
GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x1, y2);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(x1, y2);
|
||||
GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.End();
|
||||
GL.End();
|
||||
}
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.PopMatrix();
|
||||
GL.PopMatrix();
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Disable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.Disable(EnableCap.Blend);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1204,31 +1199,31 @@ namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
if (_TextureExists(ref texture))
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
|
||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
GL.Enable(EnableCap.Blend);
|
||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Begin(OpenTK.Graphics.OpenGL.BeginMode.Quads);
|
||||
GL.Begin(BeginMode.Quads);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(0f + begin * texture.WidthRatio, 0f);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + begin * rect.W, rect.Y, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(0f + begin * texture.WidthRatio, 0f);
|
||||
GL.Vertex3(rect.X + begin * rect.W, rect.Y, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(0f + begin * texture.WidthRatio, texture.HeightRatio);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + begin * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(0f + begin * texture.WidthRatio, texture.HeightRatio);
|
||||
GL.Vertex3(rect.X + begin * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(texture.WidthRatio * end, texture.HeightRatio);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + end * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(texture.WidthRatio * end, texture.HeightRatio);
|
||||
GL.Vertex3(rect.X + end * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(texture.WidthRatio * end, 0f);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + end * rect.W, rect.Y, rect.Z + CGraphics.ZOffset);
|
||||
GL.TexCoord2(texture.WidthRatio * end, 0f);
|
||||
GL.Vertex3(rect.X + end * rect.W, rect.Y, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.End();
|
||||
GL.End();
|
||||
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Disable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.Disable(EnableCap.Blend);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1249,7 +1244,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
if (_TextureExists(ref texture))
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID);
|
||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||
|
||||
float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio;
|
||||
float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio;
|
||||
@@ -1286,44 +1281,44 @@ namespace Vocaluxe.Lib.Draw
|
||||
if (ry2 > bounds.Y + bounds.H + space + height)
|
||||
ry2 = bounds.Y + bounds.H + space + height;
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
GL.Enable(EnableCap.Blend);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Texture);
|
||||
OpenTK.Graphics.OpenGL.GL.PushMatrix();
|
||||
GL.MatrixMode(MatrixMode.Texture);
|
||||
GL.PushMatrix();
|
||||
|
||||
if (Math.Abs(rect.Rotation) > float.Epsilon)
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0);
|
||||
OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
|
||||
OpenTK.Graphics.OpenGL.GL.Translate(-0.5f, -0.5f, 0);
|
||||
GL.Translate(0.5f, 0.5f, 0);
|
||||
GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
|
||||
GL.Translate(-0.5f, -0.5f, 0);
|
||||
}
|
||||
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Begin(OpenTK.Graphics.OpenGL.BeginMode.Quads);
|
||||
GL.Begin(BeginMode.Quads);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x2, y2);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
GL.TexCoord2(x2, y2);
|
||||
GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, 0f);
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x2, y1);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||
GL.Color4(color.R, color.G, color.B, 0f);
|
||||
GL.TexCoord2(x2, y1);
|
||||
GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, 0f);
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x1, y1);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||
GL.Color4(color.R, color.G, color.B, 0f);
|
||||
GL.TexCoord2(x1, y1);
|
||||
GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
OpenTK.Graphics.OpenGL.GL.TexCoord2(x1, y2);
|
||||
OpenTK.Graphics.OpenGL.GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
GL.TexCoord2(x1, y2);
|
||||
GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.End();
|
||||
GL.End();
|
||||
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.PopMatrix();
|
||||
GL.PopMatrix();
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.Disable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.Disable(EnableCap.Blend);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
}
|
||||
}
|
||||
#endregion drawing
|
||||
@@ -1333,14 +1328,14 @@ namespace Vocaluxe.Lib.Draw
|
||||
return _Textures.Count;
|
||||
}
|
||||
|
||||
private void _CheckQueque()
|
||||
private void _CheckQueue()
|
||||
{
|
||||
lock (_MutexTexture)
|
||||
{
|
||||
if (_Queque.Count == 0)
|
||||
if (_Queue.Count == 0)
|
||||
return;
|
||||
|
||||
STextureQueque q = _Queque[0];
|
||||
STextureQueue q = _Queue[0];
|
||||
STexture texture = new STexture(-1);
|
||||
if (_Textures.ContainsKey(q.ID))
|
||||
texture = _Textures[q.ID];
|
||||
@@ -1352,11 +1347,10 @@ namespace Vocaluxe.Lib.Draw
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenTK.Graphics.OpenGL.GL.GenBuffers(1, out texture.PBO);
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
OpenTK.Graphics.OpenGL.GL.BufferData(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, (IntPtr)q.Data.Length, IntPtr.Zero,
|
||||
OpenTK.Graphics.OpenGL.BufferUsageHint.StreamDraw);
|
||||
OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0);
|
||||
GL.GenBuffers(1, out texture.PBO);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, texture.PBO);
|
||||
GL.BufferData(BufferTarget.PixelUnpackBuffer, (IntPtr)q.Data.Length, IntPtr.Zero, BufferUsageHint.StreamDraw);
|
||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -1365,8 +1359,8 @@ namespace Vocaluxe.Lib.Draw
|
||||
}
|
||||
}
|
||||
|
||||
int id = OpenTK.Graphics.OpenGL.GL.GenTexture();
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id);
|
||||
int id = GL.GenTexture();
|
||||
GL.BindTexture(TextureTarget.Texture2D, id);
|
||||
texture.ID = id;
|
||||
|
||||
texture.Width = q.Width;
|
||||
@@ -1377,28 +1371,20 @@ namespace Vocaluxe.Lib.Draw
|
||||
texture.WidthRatio = texture.Width / texture.W2;
|
||||
texture.HeightRatio = texture.Height / texture.H2;
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2,
|
||||
(int)texture.H2, 0,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero);
|
||||
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.W2, (int)texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, q.Width, q.Height,
|
||||
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, q.Data);
|
||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, q.Width, q.Height, PixelFormat.Bgra, PixelType.UnsignedByte, q.Data);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureWrapS,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureParameterName.ClampToEdge);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureWrapT,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureParameterName.ClampToEdge);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMagFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMagFilter.Linear);
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMinFilter,
|
||||
(int)OpenTK.Graphics.OpenGL.TextureMinFilter.LinearMipmapLinear);
|
||||
OpenTK.Graphics.OpenGL.GL.Ext.GenerateMipmap(OpenTK.Graphics.OpenGL.GenerateMipmapTarget.Texture2D);
|
||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
|
||||
GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
|
||||
|
||||
OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
|
||||
// Add to Texture List
|
||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
||||
@@ -1407,7 +1393,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
_Textures[texture.Index] = texture;
|
||||
q.Data = null;
|
||||
_Queque.RemoveAt(0);
|
||||
_Queue.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
#endregion Textures
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
STexture AddTexture(Bitmap bitmap);
|
||||
STexture AddTexture(int w, int h, IntPtr data);
|
||||
STexture AddTexture(int w, int h, ref byte[] data);
|
||||
STexture QuequeTexture(int w, int h, ref byte[] data);
|
||||
STexture EnqueueTexture(int w, int h, ref byte[] data);
|
||||
bool UpdateTexture(ref STexture texture, ref byte[] data);
|
||||
bool UpdateTexture(ref STexture texture, IntPtr data);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Vocaluxe.Lib.Input
|
||||
ScrollUp
|
||||
}
|
||||
|
||||
interface IInput
|
||||
interface IController
|
||||
{
|
||||
void Init();
|
||||
void Close();
|
||||
@@ -27,7 +27,7 @@ using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Lib.Input.WiiMote
|
||||
{
|
||||
class CWiiMote : IInput, IDisposable
|
||||
class CWiiMote : IController, IDisposable
|
||||
{
|
||||
private CWiiMoteLib _WiiMote;
|
||||
|
||||
|
||||
@@ -155,9 +155,8 @@ namespace Vocaluxe.Lib.Playlist
|
||||
xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm);
|
||||
|
||||
CPlaylistSong playlistSong = new CPlaylistSong {SongID = -1};
|
||||
CSong[] allSongs = CSongs.AllSongs;
|
||||
|
||||
foreach (CSong curSong in allSongs)
|
||||
foreach (CSong curSong in CSongs.AllSongs)
|
||||
{
|
||||
if (curSong.Artist != artist || curSong.Title != title)
|
||||
continue;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using SlimDX.DirectSound;
|
||||
using SlimDX.Multimedia;
|
||||
using System;
|
||||
@@ -29,8 +30,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
class CDirectSoundRecord : IRecord
|
||||
{
|
||||
private bool _Initialized;
|
||||
private List<SRecordDevice> _Devices;
|
||||
private SRecordDevice[] _DeviceConfig;
|
||||
private List<CRecordDevice> _Devices;
|
||||
private List<CSoundCardSource> _Sources;
|
||||
|
||||
private readonly CBuffer[] _Buffer;
|
||||
@@ -47,7 +47,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
public bool Init()
|
||||
{
|
||||
DeviceCollection devices = DirectSoundCapture.GetDevices();
|
||||
_Devices = new List<SRecordDevice>();
|
||||
_Devices = new List<CRecordDevice>();
|
||||
_Sources = new List<CSoundCardSource>();
|
||||
|
||||
int id = 0;
|
||||
@@ -55,21 +55,17 @@ namespace Vocaluxe.Lib.Sound
|
||||
{
|
||||
using (DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid))
|
||||
{
|
||||
SRecordDevice device = new SRecordDevice {Driver = dev.DriverGuid.ToString(), ID = id, Name = dev.Description, Inputs = new List<SInput>()};
|
||||
CRecordDevice device = new CRecordDevice {Driver = dev.DriverGuid.ToString(), ID = id, Name = dev.Description, Channels = ds.Capabilities.Channels};
|
||||
|
||||
SInput inp = new SInput {Name = "Default", Channels = ds.Capabilities.Channels};
|
||||
if (device.Channels > 2)
|
||||
device.Channels = 2; //more are not supported in vocaluxe
|
||||
|
||||
if (inp.Channels > 2)
|
||||
inp.Channels = 2; //more are not supported in vocaluxe
|
||||
|
||||
device.Inputs.Add(inp);
|
||||
_Devices.Add(device);
|
||||
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
||||
_DeviceConfig = _Devices.ToArray();
|
||||
_Initialized = true;
|
||||
|
||||
return true;
|
||||
@@ -85,7 +81,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
//System.IO.File.WriteAllBytes("test0.raw", _Buffer[0].Buffer);
|
||||
}
|
||||
|
||||
public bool Start(SRecordDevice[] deviceConfig)
|
||||
public bool Start()
|
||||
{
|
||||
if (!_Initialized)
|
||||
return false;
|
||||
@@ -93,21 +89,16 @@ namespace Vocaluxe.Lib.Sound
|
||||
foreach (CBuffer buffer in _Buffer)
|
||||
buffer.Reset();
|
||||
|
||||
_DeviceConfig = deviceConfig;
|
||||
bool[] active = new bool[deviceConfig.Length];
|
||||
Guid[] guid = new Guid[deviceConfig.Length];
|
||||
short[] channels = new short[deviceConfig.Length];
|
||||
for (int dev = 0; dev < deviceConfig.Length; dev++)
|
||||
bool[] active = new bool[_Devices.Count];
|
||||
Guid[] guid = new Guid[_Devices.Count];
|
||||
short[] channels = new short[_Devices.Count];
|
||||
for (int dev = 0; dev < _Devices.Count; dev++)
|
||||
{
|
||||
active[dev] = false;
|
||||
for (int inp = 0; inp < deviceConfig[dev].Inputs.Count; inp++)
|
||||
{
|
||||
if (deviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 ||
|
||||
deviceConfig[dev].Inputs[inp].PlayerChannel2 > 0)
|
||||
active[dev] = true;
|
||||
guid[dev] = new Guid(deviceConfig[dev].Driver);
|
||||
channels[dev] = (short)deviceConfig[dev].Inputs[0].Channels;
|
||||
}
|
||||
if (_Devices[dev].PlayerChannel1 > 0 || _Devices[dev].PlayerChannel2 > 0)
|
||||
active[dev] = true;
|
||||
guid[dev] = new Guid(_Devices[dev].Driver);
|
||||
channels[dev] = (short)_Devices[dev].Channels;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _Devices.Count; i++)
|
||||
@@ -121,8 +112,6 @@ namespace Vocaluxe.Lib.Sound
|
||||
_Sources.Add(source);
|
||||
}
|
||||
}
|
||||
|
||||
_DeviceConfig = deviceConfig;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -189,7 +178,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
return _Buffer[player].ToneValid;
|
||||
}
|
||||
|
||||
public SRecordDevice[] RecordDevices()
|
||||
public ReadOnlyCollection<CRecordDevice> RecordDevices()
|
||||
{
|
||||
if (!_Initialized)
|
||||
return null;
|
||||
@@ -197,7 +186,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
if (_Devices.Count == 0)
|
||||
return null;
|
||||
|
||||
return _Devices.ToArray();
|
||||
return _Devices.AsReadOnly();
|
||||
}
|
||||
|
||||
public int NumHalfTones(int player)
|
||||
@@ -232,21 +221,21 @@ namespace Vocaluxe.Lib.Sound
|
||||
rightBuffer[i] = e.Data[i * 2 - (i % 2) + 2];
|
||||
}
|
||||
|
||||
for (int i = 0; i < _DeviceConfig.Length; i++)
|
||||
foreach (CRecordDevice device in _Devices)
|
||||
{
|
||||
if (_DeviceConfig[i].Driver == e.Guid.ToString())
|
||||
if (device.Driver == e.Guid.ToString())
|
||||
{
|
||||
if (_DeviceConfig[i].Inputs[0].PlayerChannel1 > 0)
|
||||
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
|
||||
if (device.PlayerChannel1 > 0)
|
||||
_Buffer[device.PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
|
||||
|
||||
if (_DeviceConfig[i].Inputs[0].PlayerChannel2 > 0)
|
||||
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
|
||||
if (device.PlayerChannel2 > 0)
|
||||
_Buffer[device.PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CSampleDataEventArgs : EventArgs
|
||||
private class CSampleDataEventArgs : EventArgs
|
||||
{
|
||||
public CSampleDataEventArgs(byte[] data, Guid guid)
|
||||
{
|
||||
@@ -258,7 +247,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
public Guid Guid { get; private set; }
|
||||
}
|
||||
|
||||
public class CSoundCardSource : IDisposable
|
||||
private class CSoundCardSource : IDisposable
|
||||
{
|
||||
private volatile bool _Running;
|
||||
private readonly int _BufferSize;
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace Vocaluxe.Lib.Sound
|
||||
class CGstreamerAudio : IPlayback
|
||||
{
|
||||
//static float LastPosition;
|
||||
private CGstreamerAudioWrapper.LogCallback _LogCallback;
|
||||
private readonly CGstreamerAudioWrapper.LogCallback _LogCallback;
|
||||
|
||||
#region log
|
||||
private void _LogHandler(string text)
|
||||
private static void _LogHandler(string text)
|
||||
{
|
||||
CLog.LogError(text);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -29,8 +30,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
class CPortAudioRecord : IRecord
|
||||
{
|
||||
private bool _Initialized;
|
||||
private List<SRecordDevice> _Devices;
|
||||
private SRecordDevice[] _DeviceConfig;
|
||||
private List<CRecordDevice> _Devices;
|
||||
|
||||
private CPortAudio.PaStreamCallbackDelegate _MyRecProc;
|
||||
private IntPtr[] _RecHandle;
|
||||
@@ -39,7 +39,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
|
||||
public CPortAudioRecord()
|
||||
{
|
||||
_DeviceConfig = null;
|
||||
_Devices = null;
|
||||
|
||||
_Buffer = new CBuffer[CSettings.MaxNumPlayer];
|
||||
for (int i = 0; i < _Buffer.Length; i++)
|
||||
@@ -54,7 +54,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
/// <returns>true if success</returns>
|
||||
public bool Init()
|
||||
{
|
||||
_Devices = new List<SRecordDevice>();
|
||||
_Devices = new List<CRecordDevice>();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -73,22 +73,17 @@ namespace Vocaluxe.Lib.Sound
|
||||
CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i);
|
||||
if (info.HostApi == hostAPI && info.MaxInputChannels > 0)
|
||||
{
|
||||
SRecordDevice dev = new SRecordDevice {ID = i, Name = info.Name, Driver = info.Name + i, Inputs = new List<SInput>()};
|
||||
CRecordDevice dev = new CRecordDevice {ID = i, Name = info.Name, Driver = info.Name + i, Channels = info.MaxInputChannels};
|
||||
|
||||
SInput inp = new SInput {Name = "Default", Channels = info.MaxInputChannels};
|
||||
if (dev.Channels > 2)
|
||||
dev.Channels = 2; //more are not supported in vocaluxe
|
||||
|
||||
if (inp.Channels > 2)
|
||||
inp.Channels = 2; //more are not supported in vocaluxe
|
||||
|
||||
dev.Inputs.Add(inp);
|
||||
_Devices.Add(dev);
|
||||
}
|
||||
}
|
||||
|
||||
_RecHandle = new IntPtr[_Devices.Count];
|
||||
_MyRecProc = MyPaStreamCallback;
|
||||
|
||||
_DeviceConfig = _Devices.ToArray();
|
||||
_MyRecProc = _MyPaStreamCallback;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -103,16 +98,12 @@ namespace Vocaluxe.Lib.Sound
|
||||
/// <summary>
|
||||
/// Start Voice Capturing
|
||||
/// </summary>
|
||||
/// <param name="deviceConfig"></param>
|
||||
/// <returns></returns>
|
||||
public bool Start(SRecordDevice[] deviceConfig)
|
||||
public bool Start()
|
||||
{
|
||||
if (!_Initialized)
|
||||
return false;
|
||||
|
||||
if (deviceConfig == null)
|
||||
return false;
|
||||
|
||||
if (_RecHandle == null || _RecHandle.Length == 0)
|
||||
return false;
|
||||
|
||||
@@ -132,17 +123,12 @@ namespace Vocaluxe.Lib.Sound
|
||||
for (int i = 0; i < _RecHandle.Length; i++)
|
||||
_RecHandle[i] = IntPtr.Zero;
|
||||
|
||||
_DeviceConfig = deviceConfig;
|
||||
bool[] active = new bool[deviceConfig.Length];
|
||||
for (int dev = 0; dev < deviceConfig.Length; dev++)
|
||||
bool[] active = new bool[_Devices.Count];
|
||||
for (int dev = 0; dev < _Devices.Count; dev++)
|
||||
{
|
||||
active[dev] = false;
|
||||
for (int inp = 0; inp < deviceConfig[dev].Inputs.Count; inp++)
|
||||
{
|
||||
if (deviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 ||
|
||||
deviceConfig[dev].Inputs[inp].PlayerChannel2 > 0)
|
||||
active[dev] = true;
|
||||
}
|
||||
if (_Devices[dev].PlayerChannel1 > 0 || _Devices[dev].PlayerChannel2 > 0)
|
||||
active[dev] = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _RecHandle.Length; i++)
|
||||
@@ -151,10 +137,10 @@ namespace Vocaluxe.Lib.Sound
|
||||
{
|
||||
CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters
|
||||
{
|
||||
ChannelCount = _DeviceConfig[i].Inputs[0].Channels,
|
||||
Device = _DeviceConfig[i].ID,
|
||||
ChannelCount = _Devices[i].Channels,
|
||||
Device = _Devices[i].ID,
|
||||
SampleFormat = CPortAudio.EPaSampleFormat.PaInt16,
|
||||
SuggestedLatency = CPortAudio.PaGetDeviceInfo(_DeviceConfig[i].ID).DefaultLowInputLatency
|
||||
SuggestedLatency = CPortAudio.PaGetDeviceInfo(_Devices[i].ID).DefaultLowInputLatency
|
||||
};
|
||||
|
||||
if (_ErrorCheck("OpenStream (rec)", CPortAudio.Pa_OpenStream(
|
||||
@@ -273,7 +259,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
return _Buffer[player].ToneWeigth;
|
||||
}
|
||||
|
||||
public SRecordDevice[] RecordDevices()
|
||||
public ReadOnlyCollection<CRecordDevice> RecordDevices()
|
||||
{
|
||||
if (!_Initialized)
|
||||
return null;
|
||||
@@ -281,10 +267,10 @@ namespace Vocaluxe.Lib.Sound
|
||||
if (_Devices.Count == 0)
|
||||
return null;
|
||||
|
||||
return _Devices.ToArray();
|
||||
return _Devices.AsReadOnly();
|
||||
}
|
||||
|
||||
public CPortAudio.EPaStreamCallbackResult MyPaStreamCallback(
|
||||
private CPortAudio.EPaStreamCallbackResult _MyPaStreamCallback(
|
||||
IntPtr input,
|
||||
IntPtr output,
|
||||
uint frameCount,
|
||||
@@ -315,11 +301,11 @@ namespace Vocaluxe.Lib.Sound
|
||||
{
|
||||
if (new IntPtr(i) == userData)
|
||||
{
|
||||
if (_DeviceConfig[i].Inputs[0].PlayerChannel1 > 0)
|
||||
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
|
||||
if (_Devices[i].PlayerChannel1 > 0)
|
||||
_Buffer[_Devices[i].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
|
||||
|
||||
if (_DeviceConfig[i].Inputs[0].PlayerChannel2 > 0)
|
||||
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
|
||||
if (_Devices[i].PlayerChannel2 > 0)
|
||||
_Buffer[_Devices[i].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ namespace Vocaluxe.Lib.Sound.Gstreamer
|
||||
#region arch
|
||||
#if ARCH_X86
|
||||
#if WIN
|
||||
private const string _Dll = "x86\\gstreamer\\gstreamerhelper.dll";
|
||||
private const string _Dll = "x86\\gstreamer\\GstreamerHelper.dll";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ARCH_X64
|
||||
#if WIN
|
||||
private const string _Dll = "x64\\gstreamer\\gstreamerhelper.dll";
|
||||
private const string _Dll = "x64\\gstreamer\\GstreamerHelper.dll";
|
||||
#endif
|
||||
#endif
|
||||
#endregion arch
|
||||
|
||||
@@ -18,23 +18,17 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Vocaluxe.Lib.Sound
|
||||
{
|
||||
struct SRecordDevice
|
||||
class CRecordDevice
|
||||
{
|
||||
public int ID;
|
||||
public string Name;
|
||||
public string Driver;
|
||||
public List<SInput> Inputs;
|
||||
}
|
||||
|
||||
struct SInput
|
||||
{
|
||||
public string Name;
|
||||
public int Channels;
|
||||
|
||||
public int PlayerChannel1;
|
||||
public int PlayerChannel2;
|
||||
}
|
||||
@@ -43,7 +37,6 @@ namespace Vocaluxe.Lib.Sound
|
||||
{
|
||||
public string DeviceName;
|
||||
public string DeviceDriver;
|
||||
public string InputName;
|
||||
public int Channel;
|
||||
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
@@ -52,7 +45,6 @@ namespace Vocaluxe.Lib.Sound
|
||||
{
|
||||
DeviceName = String.Empty;
|
||||
DeviceDriver = String.Empty;
|
||||
InputName = String.Empty;
|
||||
Channel = 0;
|
||||
}
|
||||
}
|
||||
@@ -62,7 +54,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
bool Init();
|
||||
void CloseAll();
|
||||
|
||||
bool Start(SRecordDevice[] deviceConfig);
|
||||
bool Start();
|
||||
bool Stop();
|
||||
void AnalyzeBuffer(int player);
|
||||
|
||||
@@ -74,6 +66,6 @@ namespace Vocaluxe.Lib.Sound
|
||||
int NumHalfTones(int player);
|
||||
float[] ToneWeigth(int player);
|
||||
|
||||
SRecordDevice[] RecordDevices();
|
||||
ReadOnlyCollection<CRecordDevice> RecordDevices();
|
||||
}
|
||||
}
|
||||
+8
-5
@@ -25,6 +25,7 @@ using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using Vocaluxe.Base.Font;
|
||||
|
||||
namespace Vocaluxe
|
||||
{
|
||||
@@ -184,8 +185,8 @@ namespace Vocaluxe
|
||||
|
||||
// Init Input
|
||||
CLog.StartBenchmark(0, "Init Input");
|
||||
CInput.Init();
|
||||
CInput.Connect();
|
||||
CController.Init();
|
||||
CController.Connect();
|
||||
CLog.StopBenchmark(0, "Init Input");
|
||||
|
||||
// Init Game;
|
||||
@@ -201,9 +202,9 @@ namespace Vocaluxe
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Error on start up: " + e.Message + e.StackTrace);
|
||||
CLog.LogError("Error on start up: " + e.Message + e.StackTrace);
|
||||
CLog.LogError("Error on start up: " + e);
|
||||
_SplashScreen.Close();
|
||||
_CloseProgram();
|
||||
Environment.Exit(Environment.ExitCode);
|
||||
}
|
||||
Application.DoEvents();
|
||||
|
||||
@@ -219,7 +220,7 @@ namespace Vocaluxe
|
||||
try
|
||||
{
|
||||
CLog.CloseAll();
|
||||
CInput.Close();
|
||||
CController.Close();
|
||||
CSound.RecordCloseAll();
|
||||
CSound.CloseAllStreams();
|
||||
CVideo.VdCloseAll();
|
||||
@@ -228,6 +229,7 @@ namespace Vocaluxe
|
||||
CWebcam.Close();
|
||||
}
|
||||
catch (Exception) {}
|
||||
Environment.Exit(Environment.ExitCode);
|
||||
}
|
||||
|
||||
[HandleProcessCorruptedStateExceptions]
|
||||
@@ -242,6 +244,7 @@ namespace Vocaluxe
|
||||
catch {}
|
||||
MessageBox.Show("Unhandled exception: " + e.Message + stackTrace);
|
||||
CLog.LogError("Unhandled exception: " + e.Message + stackTrace);
|
||||
_CloseProgram();
|
||||
}
|
||||
|
||||
private static Assembly _AssemblyResolver(Object sender, ResolveEventArgs args)
|
||||
|
||||
@@ -219,12 +219,12 @@ namespace Vocaluxe.Screens
|
||||
|
||||
for (int round = 0; round < points.NumRounds; round++)
|
||||
{
|
||||
SPlayer[] player = points.GetPlayer(round, CGame.NumPlayer);
|
||||
SPlayer[] players = points.GetPlayer(round, CGame.NumPlayer);
|
||||
|
||||
for (int p = 0; p < player.Length; p++)
|
||||
for (int p = 0; p < players.Length; p++)
|
||||
{
|
||||
if (player[p].Points > CSettings.MinScoreForDB && player[p].SongFinished && !CProfiles.IsGuestProfile(player[p].ProfileID))
|
||||
_NewEntryIDs.Add(CDataBase.AddScore(player[p]));
|
||||
if (players[p].Points > CSettings.MinScoreForDB && players[p].SongFinished && !CProfiles.IsGuestProfile(players[p].ProfileID))
|
||||
_NewEntryIDs.Add(CDataBase.AddScore(players[p]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,7 +255,7 @@ namespace Vocaluxe.Screens
|
||||
if (points.NumRounds > 1)
|
||||
_Texts[_TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")";
|
||||
|
||||
switch (CGame.GetGameMode(_Round))
|
||||
switch (CGame.GetGameMode(_Round + 1))
|
||||
{
|
||||
case EGameMode.TR_GAMEMODE_NORMAL:
|
||||
_Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL";
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Base.Font;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Screens
|
||||
|
||||
@@ -56,9 +56,10 @@ namespace Vocaluxe.Screens
|
||||
private readonly STexture[] _OriginalPlayerAvatarTextures = new STexture[CSettings.MaxNumPlayer];
|
||||
|
||||
private bool _SelectingKeyboardActive;
|
||||
private bool _SelectingKeyboardUnendless;
|
||||
private int _SelectingKeyboardPlayerNr;
|
||||
private int _SelectedPlayerNr;
|
||||
private bool _SelectingFast;
|
||||
private int _SelectingSwitchNr = -1;
|
||||
private int _SelectingFastPlayerNr = 0;
|
||||
private int _SelectedPlayerNr = -1;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
@@ -137,16 +138,17 @@ namespace Vocaluxe.Screens
|
||||
case Keys.P:
|
||||
if (!_SelectingKeyboardActive)
|
||||
{
|
||||
_SelectingKeyboardPlayerNr = 1;
|
||||
_SelectingKeyboardUnendless = true;
|
||||
_SelectingFastPlayerNr = 1;
|
||||
_SelectingFast = true;
|
||||
_ResetPlayerSelections();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_SelectingKeyboardPlayerNr + 1 <= CGame.NumPlayer)
|
||||
_SelectingKeyboardPlayerNr++;
|
||||
if (_SelectingFastPlayerNr + 1 <= CGame.NumPlayer)
|
||||
_SelectingFastPlayerNr++;
|
||||
else
|
||||
_SelectingKeyboardPlayerNr = 1;
|
||||
_NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr);
|
||||
_SelectingFastPlayerNr = 1;
|
||||
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -165,13 +167,13 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
_SelectedPlayerNr = _NameSelections[_NameSelection].Selection;
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingKeyboardPlayerNr - 1].ProfileID = _SelectedPlayerNr;
|
||||
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = _SelectedPlayerNr;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingKeyboardPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
|
||||
CConfig.Players[_SelectingFastPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture;
|
||||
_Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName;
|
||||
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture;
|
||||
_Texts[_TextPlayer[_SelectingFastPlayerNr - 1]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName;
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
@@ -179,14 +181,14 @@ namespace Vocaluxe.Screens
|
||||
_SetInteractionToButton(_Buttons[_ButtonStart]);
|
||||
}
|
||||
//Started selecting with 'P'
|
||||
if (_SelectingKeyboardUnendless)
|
||||
if (_SelectingFast)
|
||||
{
|
||||
if (_SelectingKeyboardPlayerNr == CGame.NumPlayer)
|
||||
if (_SelectingFastPlayerNr == CGame.NumPlayer)
|
||||
resetSelection = true;
|
||||
else
|
||||
{
|
||||
_SelectingKeyboardPlayerNr++;
|
||||
_NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr);
|
||||
_SelectingFastPlayerNr++;
|
||||
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -224,19 +226,19 @@ namespace Vocaluxe.Screens
|
||||
|
||||
case Keys.Delete:
|
||||
//Delete profile-selection
|
||||
CGame.Players[_SelectingKeyboardPlayerNr - 1].ProfileID = -1;
|
||||
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = -1;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingKeyboardPlayerNr - 1] = String.Empty;
|
||||
CConfig.Players[_SelectingFastPlayerNr - 1] = String.Empty;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingKeyboardPlayerNr - 1];
|
||||
_Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CProfiles.GetPlayerName(-1, _SelectingKeyboardPlayerNr);
|
||||
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingFastPlayerNr - 1];
|
||||
_Texts[_TextPlayer[_SelectingFastPlayerNr - 1]].Text = CProfiles.GetPlayerName(-1, _SelectingFastPlayerNr);
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Reset all values
|
||||
_SelectingKeyboardPlayerNr = 0;
|
||||
_SelectingFastPlayerNr = 0;
|
||||
_SelectingKeyboardActive = false;
|
||||
_NameSelections[_NameSelection].KeyboardSelection(false, -1);
|
||||
_NameSelections[_NameSelection].FastSelection(false, -1);
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
break;
|
||||
@@ -244,32 +246,32 @@ namespace Vocaluxe.Screens
|
||||
case Keys.F10:
|
||||
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
|
||||
{
|
||||
CSelectSlide selectSlideDuetPart = _SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]];
|
||||
CSelectSlide selectSlideDuetPart = _SelectSlides[_SelectSlideDuetPlayer[_SelectingFastPlayerNr - 1]];
|
||||
selectSlideDuetPart.Selection = (selectSlideDuetPart.Selection + 1) % 2;
|
||||
//Reset all values
|
||||
_SelectingKeyboardPlayerNr = 0;
|
||||
_SelectingFastPlayerNr = 0;
|
||||
_SelectingKeyboardActive = false;
|
||||
_SelectingKeyboardUnendless = false;
|
||||
_NameSelections[_NameSelection].KeyboardSelection(false, -1);
|
||||
_SelectingFast = false;
|
||||
_NameSelections[_NameSelection].FastSelection(false, -1);
|
||||
_SetInteractionToButton(_Buttons[_ButtonStart]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (numberPressed > 0 || resetSelection)
|
||||
{
|
||||
if (numberPressed == _SelectingKeyboardPlayerNr || resetSelection)
|
||||
if (numberPressed == _SelectingFastPlayerNr || resetSelection)
|
||||
{
|
||||
//Reset all values
|
||||
_SelectingKeyboardPlayerNr = 0;
|
||||
_SelectingFastPlayerNr = 0;
|
||||
_SelectingKeyboardActive = false;
|
||||
_NameSelections[_NameSelection].KeyboardSelection(false, -1);
|
||||
_NameSelections[_NameSelection].FastSelection(false, -1);
|
||||
}
|
||||
else if (numberPressed <= CConfig.NumPlayer)
|
||||
{
|
||||
_SelectingKeyboardPlayerNr = numberPressed;
|
||||
_NameSelections[_NameSelection].KeyboardSelection(true, numberPressed);
|
||||
_SelectingFastPlayerNr = numberPressed;
|
||||
_NameSelections[_NameSelection].FastSelection(true, numberPressed);
|
||||
}
|
||||
_SelectingKeyboardUnendless = false;
|
||||
_SelectingFast = false;
|
||||
}
|
||||
}
|
||||
//Normal Keyboard handling
|
||||
@@ -294,32 +296,32 @@ namespace Vocaluxe.Screens
|
||||
|
||||
case Keys.D1:
|
||||
case Keys.NumPad1:
|
||||
_SelectingKeyboardPlayerNr = 1;
|
||||
_SelectingFastPlayerNr = 1;
|
||||
break;
|
||||
|
||||
case Keys.D2:
|
||||
case Keys.NumPad2:
|
||||
_SelectingKeyboardPlayerNr = 2;
|
||||
_SelectingFastPlayerNr = 2;
|
||||
break;
|
||||
|
||||
case Keys.D3:
|
||||
case Keys.NumPad3:
|
||||
_SelectingKeyboardPlayerNr = 3;
|
||||
_SelectingFastPlayerNr = 3;
|
||||
break;
|
||||
|
||||
case Keys.D4:
|
||||
case Keys.NumPad4:
|
||||
_SelectingKeyboardPlayerNr = 4;
|
||||
_SelectingFastPlayerNr = 4;
|
||||
break;
|
||||
|
||||
case Keys.D5:
|
||||
case Keys.NumPad5:
|
||||
_SelectingKeyboardPlayerNr = 5;
|
||||
_SelectingFastPlayerNr = 5;
|
||||
break;
|
||||
|
||||
case Keys.D6:
|
||||
case Keys.NumPad6:
|
||||
_SelectingKeyboardPlayerNr = 6;
|
||||
_SelectingFastPlayerNr = 6;
|
||||
break;
|
||||
default:
|
||||
_UpdatePlayerNumber();
|
||||
@@ -327,10 +329,10 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
|
||||
|
||||
if (_SelectingKeyboardPlayerNr > 0 && _SelectingKeyboardPlayerNr <= CConfig.NumPlayer)
|
||||
if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.NumPlayer)
|
||||
{
|
||||
_SelectingKeyboardActive = true;
|
||||
_NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr);
|
||||
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,10 +341,15 @@ namespace Vocaluxe.Screens
|
||||
|
||||
public override bool HandleMouse(SMouseEvent mouseEvent)
|
||||
{
|
||||
base.HandleMouse(mouseEvent);
|
||||
bool stopSelectingFast = false;
|
||||
|
||||
if (_SelectingFast)
|
||||
_NameSelections[_NameSelection].HandleMouse(mouseEvent);
|
||||
else
|
||||
base.HandleMouse(mouseEvent);
|
||||
|
||||
//Check if LeftButton is hold and Select-Mode inactive
|
||||
if (mouseEvent.LBH && _SelectedPlayerNr < 0)
|
||||
if (mouseEvent.LBH && _SelectedPlayerNr < 0 && !_SelectingFast)
|
||||
{
|
||||
//Save mouse-coords
|
||||
_OldMouseX = mouseEvent.X;
|
||||
@@ -363,10 +370,29 @@ namespace Vocaluxe.Screens
|
||||
_ChooseAvatarStatic.Texture = selectedPlayer.Texture;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||
{
|
||||
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
|
||||
{
|
||||
_SelectingSwitchNr = i;
|
||||
_SelectedPlayerNr = CGame.Players[i].ProfileID;
|
||||
//Update of Drag/Drop-Texture
|
||||
CStatic selectedPlayer = _Statics[_StaticPlayerAvatar[i]];
|
||||
_ChooseAvatarStatic.Visible = true;
|
||||
_ChooseAvatarStatic.Rect = selectedPlayer.Rect;
|
||||
_ChooseAvatarStatic.Rect.Z = CSettings.ZNear;
|
||||
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
|
||||
_ChooseAvatarStatic.Texture = selectedPlayer.Texture;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Check if LeftButton is hold and Select-Mode active
|
||||
if (mouseEvent.LBH && _SelectedPlayerNr >= 0)
|
||||
if (mouseEvent.LBH && _SelectedPlayerNr >= 0 && !_SelectingFast)
|
||||
{
|
||||
//Update coords for Drag/Drop-Texture
|
||||
_ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX;
|
||||
@@ -374,8 +400,8 @@ namespace Vocaluxe.Screens
|
||||
_OldMouseX = mouseEvent.X;
|
||||
_OldMouseY = mouseEvent.Y;
|
||||
}
|
||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||
else if (_SelectedPlayerNr >= 0)
|
||||
// LeftButton isn't hold anymore, but Select-Mode is still active -> "Drop" of Avatar
|
||||
else if (_SelectedPlayerNr >= 0 && !_SelectingFast)
|
||||
{
|
||||
//Foreach Drop-Area
|
||||
for (int i = 0; i < _StaticPlayer.Length; i++)
|
||||
@@ -386,6 +412,26 @@ namespace Vocaluxe.Screens
|
||||
//Check if Mouse is in area
|
||||
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
|
||||
{
|
||||
if (_SelectingSwitchNr > -1 && CGame.Players[i].ProfileID > -1)
|
||||
{
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingSwitchNr].ProfileID = CGame.Players[i].ProfileID;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingSwitchNr] = CProfiles.Profiles[i].ProfileFile;
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture;
|
||||
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.Profiles[CGame.Players[i].ProfileID].PlayerName;
|
||||
}
|
||||
else if (_SelectingSwitchNr > -1)
|
||||
{
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingSwitchNr].ProfileID = -1;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingSwitchNr] = string.Empty;
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = _OriginalPlayerAvatarTextures[_SelectingSwitchNr];
|
||||
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(-1, (_SelectingSwitchNr+1));
|
||||
}
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[i].ProfileID = _SelectedPlayerNr;
|
||||
//Update config for default players.
|
||||
@@ -398,14 +444,57 @@ namespace Vocaluxe.Screens
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
break;
|
||||
}
|
||||
//Selected player is dropped out of area
|
||||
else if (_SelectingSwitchNr > -1)
|
||||
{
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingSwitchNr].ProfileID = -1;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingSwitchNr] = string.Empty;
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = _OriginalPlayerAvatarTextures[_SelectingSwitchNr];
|
||||
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(-1, (_SelectingSwitchNr + 1));
|
||||
}
|
||||
}
|
||||
_SelectingSwitchNr = -1;
|
||||
_SelectedPlayerNr = -1;
|
||||
//Reset variables
|
||||
_ChooseAvatarStatic.Visible = false;
|
||||
}
|
||||
|
||||
if (mouseEvent.LB && _IsMouseOver(mouseEvent))
|
||||
if (mouseEvent.LB && _SelectingFast)
|
||||
{
|
||||
if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
|
||||
{
|
||||
//Get player-number of tile
|
||||
_SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
|
||||
if (_SelectedPlayerNr != -1)
|
||||
{
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = _SelectedPlayerNr;
|
||||
//Update config for default players.
|
||||
CConfig.Players[_SelectingFastPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture;
|
||||
_Texts[_TextPlayer[_SelectingFastPlayerNr - 1]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName;
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
_SelectingFastPlayerNr++;
|
||||
if (_SelectingFastPlayerNr <= CGame.NumPlayer)
|
||||
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
|
||||
else
|
||||
stopSelectingFast = true;
|
||||
}
|
||||
else
|
||||
stopSelectingFast = true;
|
||||
}
|
||||
}
|
||||
else if (mouseEvent.LB && _IsMouseOver(mouseEvent))
|
||||
{
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
@@ -417,7 +506,36 @@ namespace Vocaluxe.Screens
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
if (mouseEvent.LD && _NameSelections[_NameSelection].IsOverTile(mouseEvent) && !_SelectingFast)
|
||||
{
|
||||
_SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
|
||||
if (_SelectedPlayerNr > -1)
|
||||
{
|
||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||
{
|
||||
if (CGame.Players[i].ProfileID == -1)
|
||||
{
|
||||
//Update Game-infos with new player
|
||||
CGame.Players[i].ProfileID = _SelectedPlayerNr;
|
||||
//Update config for default players.
|
||||
CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
|
||||
CConfig.SaveConfig();
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture;
|
||||
_Texts[_TextPlayer[i]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName;
|
||||
//Update profile-warning
|
||||
_CheckPlayers();
|
||||
//Update Tiles-List
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mouseEvent.RB && _SelectingFast)
|
||||
stopSelectingFast = true;
|
||||
else if (mouseEvent.RB)
|
||||
{
|
||||
bool exit = true;
|
||||
//Remove profile-selection
|
||||
@@ -443,6 +561,23 @@ namespace Vocaluxe.Screens
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
}
|
||||
|
||||
if (mouseEvent.MB && _SelectingFast)
|
||||
{
|
||||
_SelectingFastPlayerNr++;
|
||||
if (_SelectingFastPlayerNr <= CGame.NumPlayer)
|
||||
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
|
||||
else
|
||||
stopSelectingFast = true;
|
||||
}
|
||||
else if(mouseEvent.MB)
|
||||
{
|
||||
_ResetPlayerSelections();
|
||||
_SelectingFast = true;
|
||||
_SelectingFastPlayerNr = 1;
|
||||
_SelectingKeyboardActive = true;
|
||||
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
|
||||
}
|
||||
|
||||
//Check mouse-wheel for scrolling
|
||||
if (mouseEvent.Wheel != 0)
|
||||
{
|
||||
@@ -452,6 +587,14 @@ namespace Vocaluxe.Screens
|
||||
_NameSelections[_NameSelection].UpdateList(offset);
|
||||
}
|
||||
}
|
||||
|
||||
if (stopSelectingFast)
|
||||
{
|
||||
_SelectingFast = false;
|
||||
_SelectingFastPlayerNr = 0;
|
||||
_SelectingKeyboardActive = false;
|
||||
_NameSelections[_NameSelection].FastSelection(false, -1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -565,6 +708,21 @@ namespace Vocaluxe.Screens
|
||||
_CheckPlayers();
|
||||
}
|
||||
|
||||
private void _ResetPlayerSelections()
|
||||
{
|
||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||
{
|
||||
CGame.Players[i].ProfileID = -1;
|
||||
//Update config for default players.
|
||||
CConfig.Players[i] = String.Empty;
|
||||
//Update texture and name
|
||||
_Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i];
|
||||
_Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(-1, i + 1);
|
||||
}
|
||||
_NameSelections[_NameSelection].UpdateList();
|
||||
CConfig.SaveConfig();
|
||||
}
|
||||
|
||||
private void _CheckMics()
|
||||
{
|
||||
List<int> playerWithoutMicro = new List<int>();
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace Vocaluxe.Screens
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 1; }
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
private const string _SelectSlideLyricStyle = "SelectSlideLyricStyle";
|
||||
private const string _SelectSlideLyricsOnTop = "SelectSlideLyricsOnTop";
|
||||
private const string _SelectSlideLyricsPosition = "SelectSlideLyricsPosition";
|
||||
|
||||
private const string _ButtonExit = "ButtonExit";
|
||||
|
||||
@@ -41,14 +41,14 @@ namespace Vocaluxe.Screens
|
||||
base.Init();
|
||||
|
||||
_ThemeButtons = new string[] {_ButtonExit};
|
||||
_ThemeSelectSlides = new string[] {_SelectSlideLyricStyle, _SelectSlideLyricsOnTop};
|
||||
_ThemeSelectSlides = new string[] {_SelectSlideLyricStyle, _SelectSlideLyricsPosition};
|
||||
}
|
||||
|
||||
public override void LoadTheme(string xmlPath)
|
||||
{
|
||||
base.LoadTheme(xmlPath);
|
||||
_SelectSlides[_SelectSlideLyricStyle].SetValues<ELyricStyle>((int)CConfig.LyricStyle);
|
||||
_SelectSlides[_SelectSlideLyricsOnTop].SetValues<EOffOn>((int)CConfig.LyricsOnTop);
|
||||
_SelectSlides[_SelectSlideLyricsPosition].SetValues<ELyricsPosition>((int)CConfig.LyricsPosition);
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
@@ -122,7 +122,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _SaveConfig()
|
||||
{
|
||||
CConfig.LyricsOnTop = (EOffOn)_SelectSlides[_SelectSlideLyricsOnTop].Selection;
|
||||
CConfig.LyricsPosition = (ELyricsPosition)_SelectSlides[_SelectSlideLyricsPosition].Selection;
|
||||
CConfig.LyricStyle = (ELyricStyle)_SelectSlides[_SelectSlideLyricStyle].Selection;
|
||||
CConfig.SaveConfig();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
@@ -37,12 +38,11 @@ namespace Vocaluxe.Screens
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 2; }
|
||||
get { return 3; }
|
||||
}
|
||||
|
||||
private const float _MaxDelayTime = 1f;
|
||||
private const string _SelectSlideRecordDevices = "SelectSlideRecordDevices";
|
||||
private const string _SelectSlideRecordInputs = "SelectSlideRecordInputs";
|
||||
|
||||
private const string _SelectSlideRecordChannel1 = "SelectSlideRecordChannel1";
|
||||
private const string _SelectSlideRecordChannel2 = "SelectSlideRecordChannel2";
|
||||
@@ -63,9 +63,8 @@ namespace Vocaluxe.Screens
|
||||
private readonly string[] _StaticEnergyChannel = new string[] {"StaticEnergyChannel1", "StaticEnergyChannel2"};
|
||||
private float[] _ChannelEnergy;
|
||||
|
||||
private SRecordDevice[] _Devices;
|
||||
private ReadOnlyCollection<CRecordDevice> _Devices;
|
||||
private int _DeviceNr;
|
||||
private int _InputNr;
|
||||
|
||||
private SDelayTest[] _DelayTest;
|
||||
private bool _DelayTestRunning;
|
||||
@@ -81,7 +80,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
_ThemeTexts = new string[] {_TextWarning, _TextDelayChannel1, _TextDelayChannel2};
|
||||
_ThemeButtons = new string[] {_ButtonExit, _ButtonDelayTest};
|
||||
_ThemeSelectSlides = new string[] {_SelectSlideRecordDevices, _SelectSlideRecordInputs, _SelectSlideRecordChannel1, _SelectSlideRecordChannel2, _SelectSlideDelay};
|
||||
_ThemeSelectSlides = new string[] {_SelectSlideRecordDevices, _SelectSlideRecordChannel1, _SelectSlideRecordChannel2, _SelectSlideDelay};
|
||||
_ThemeEqualizers = new string[] {_EqualizerChannel1, _EqualizerChannel2};
|
||||
}
|
||||
|
||||
@@ -160,9 +159,6 @@ namespace Vocaluxe.Screens
|
||||
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
|
||||
_OnDeviceEvent();
|
||||
|
||||
if (_SelectSlides[_SelectSlideRecordInputs].Selected)
|
||||
_OnInputEvent();
|
||||
|
||||
if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
|
||||
_SelectSlides[_SelectSlideRecordChannel2].Selected)
|
||||
_SetMicConfig();
|
||||
@@ -175,9 +171,6 @@ namespace Vocaluxe.Screens
|
||||
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
|
||||
_OnDeviceEvent();
|
||||
|
||||
if (_SelectSlides[_SelectSlideRecordInputs].Selected)
|
||||
_OnInputEvent();
|
||||
|
||||
if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
|
||||
_SelectSlides[_SelectSlideRecordChannel2].Selected)
|
||||
_SetMicConfig();
|
||||
@@ -205,9 +198,6 @@ namespace Vocaluxe.Screens
|
||||
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
|
||||
_OnDeviceEvent();
|
||||
|
||||
if (_SelectSlides[_SelectSlideRecordInputs].Selected)
|
||||
_OnInputEvent();
|
||||
|
||||
if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
|
||||
_SelectSlides[_SelectSlideRecordChannel2].Selected)
|
||||
_SetMicConfig();
|
||||
@@ -311,28 +301,22 @@ namespace Vocaluxe.Screens
|
||||
base.OnShow();
|
||||
|
||||
_SelectSlides[_SelectSlideRecordDevices].Clear();
|
||||
_SelectSlides[_SelectSlideRecordInputs].Clear();
|
||||
|
||||
for (int i = 0; i < _ChannelEnergy.Length; i++)
|
||||
_ChannelEnergy[i] = 0f;
|
||||
|
||||
_DeviceNr = -1;
|
||||
_InputNr = -1;
|
||||
|
||||
_Devices = CSound.RecordGetDevices();
|
||||
if (_Devices != null)
|
||||
{
|
||||
_DeviceNr = 0;
|
||||
_InputNr = 0;
|
||||
_GetFirstConfiguredRecordDevice(ref _DeviceNr, ref _InputNr);
|
||||
_GetFirstConfiguredRecordDevice(ref _DeviceNr);
|
||||
|
||||
for (int dev = 0; dev < _Devices.Length; dev++)
|
||||
_SelectSlides[_SelectSlideRecordDevices].AddValue(_Devices[dev].Name);
|
||||
foreach (CRecordDevice device in _Devices)
|
||||
_SelectSlides[_SelectSlideRecordDevices].AddValue(device.Name);
|
||||
_SelectSlides[_SelectSlideRecordDevices].Selection = _DeviceNr;
|
||||
|
||||
for (int inp = 0; inp < _Devices[0].Inputs.Count; inp++)
|
||||
_SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[0].Inputs[inp].Name);
|
||||
_SelectSlides[_SelectSlideRecordInputs].Selection = _InputNr;
|
||||
_UpdateChannels();
|
||||
}
|
||||
|
||||
@@ -416,24 +400,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (_SelectSlides[_SelectSlideRecordDevices].Selection != _DeviceNr)
|
||||
{
|
||||
_SelectSlides[_SelectSlideRecordInputs].Clear();
|
||||
_DeviceNr = _SelectSlides[_SelectSlideRecordDevices].Selection;
|
||||
_InputNr = 0;
|
||||
|
||||
for (int inp = 0; inp < _Devices[_DeviceNr].Inputs.Count; inp++)
|
||||
_SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[_DeviceNr].Inputs[inp].Name);
|
||||
_InputNr = 0;
|
||||
_SelectSlides[_SelectSlideRecordInputs].Selection = 0;
|
||||
_UpdateChannels();
|
||||
}
|
||||
}
|
||||
|
||||
private void _OnInputEvent()
|
||||
{
|
||||
if (_SelectSlides[_SelectSlideRecordInputs].Selection != _InputNr)
|
||||
{
|
||||
_InputNr = _SelectSlides[_SelectSlideRecordInputs].Selection;
|
||||
|
||||
_UpdateChannels();
|
||||
}
|
||||
}
|
||||
@@ -457,25 +424,20 @@ namespace Vocaluxe.Screens
|
||||
for (int p = 0; p < CSettings.MaxNumPlayer; p++)
|
||||
CConfig.MicConfig[p].Channel = 0;
|
||||
|
||||
for (int dev = 0; dev < _Devices.Length; dev++)
|
||||
foreach (CRecordDevice device in _Devices)
|
||||
{
|
||||
for (int inp = 0; inp < _Devices[dev].Inputs.Count; inp++)
|
||||
if (device.PlayerChannel1 > 0)
|
||||
{
|
||||
if (_Devices[dev].Inputs[inp].PlayerChannel1 > 0)
|
||||
{
|
||||
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].Channel = 1;
|
||||
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].DeviceName = _Devices[dev].Name;
|
||||
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].DeviceDriver = _Devices[dev].Driver;
|
||||
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].InputName = _Devices[dev].Inputs[inp].Name;
|
||||
}
|
||||
CConfig.MicConfig[device.PlayerChannel1 - 1].Channel = 1;
|
||||
CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceName = device.Name;
|
||||
CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceDriver = device.Driver;
|
||||
}
|
||||
|
||||
if (_Devices[dev].Inputs[inp].PlayerChannel2 > 0)
|
||||
{
|
||||
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].Channel = 2;
|
||||
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceName = _Devices[dev].Name;
|
||||
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceDriver = _Devices[dev].Driver;
|
||||
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].InputName = _Devices[dev].Inputs[inp].Name;
|
||||
}
|
||||
if (device.PlayerChannel2 > 0)
|
||||
{
|
||||
CConfig.MicConfig[device.PlayerChannel2 - 1].Channel = 2;
|
||||
CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceName = device.Name;
|
||||
CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceDriver = device.Driver;
|
||||
}
|
||||
}
|
||||
CConfig.SaveConfig();
|
||||
@@ -487,16 +449,15 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (_DeviceNr < 0)
|
||||
return;
|
||||
SInput input = _Devices[_DeviceNr].Inputs[_InputNr];
|
||||
input.PlayerChannel1 = _SelectSlides[_SelectSlideRecordChannel1].Selection;
|
||||
input.PlayerChannel2 = _SelectSlides[_SelectSlideRecordChannel2].Selection;
|
||||
_Devices[_DeviceNr].Inputs[_InputNr] = input;
|
||||
CRecordDevice device = _Devices[_DeviceNr];
|
||||
device.PlayerChannel1 = _SelectSlides[_SelectSlideRecordChannel1].Selection;
|
||||
device.PlayerChannel2 = _SelectSlides[_SelectSlideRecordChannel2].Selection;
|
||||
}
|
||||
|
||||
private void _UpdateChannels()
|
||||
{
|
||||
_SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel1;
|
||||
_SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel2;
|
||||
_SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].PlayerChannel1;
|
||||
_SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].PlayerChannel2;
|
||||
|
||||
_SaveMicConfig();
|
||||
}
|
||||
@@ -510,25 +471,22 @@ namespace Vocaluxe.Screens
|
||||
if (_Devices == null)
|
||||
return true;
|
||||
|
||||
for (int dev = 0; dev < _Devices.Length; dev++)
|
||||
foreach (CRecordDevice device in _Devices)
|
||||
{
|
||||
for (int inp = 0; inp < _Devices[dev].Inputs.Count; inp++)
|
||||
if (device.PlayerChannel1 > 0)
|
||||
{
|
||||
if (_Devices[dev].Inputs[inp].PlayerChannel1 > 0)
|
||||
{
|
||||
if (isSet[_Devices[dev].Inputs[inp].PlayerChannel1 - 1])
|
||||
return false;
|
||||
if (isSet[device.PlayerChannel1 - 1])
|
||||
return false;
|
||||
|
||||
isSet[_Devices[dev].Inputs[inp].PlayerChannel1 - 1] = true;
|
||||
}
|
||||
isSet[device.PlayerChannel1 - 1] = true;
|
||||
}
|
||||
|
||||
if (_Devices[dev].Inputs[inp].PlayerChannel2 > 0)
|
||||
{
|
||||
if (isSet[_Devices[dev].Inputs[inp].PlayerChannel2 - 1])
|
||||
return false;
|
||||
if (device.PlayerChannel2 > 0)
|
||||
{
|
||||
if (isSet[device.PlayerChannel2 - 1])
|
||||
return false;
|
||||
|
||||
isSet[_Devices[dev].Inputs[inp].PlayerChannel2 - 1] = true;
|
||||
}
|
||||
isSet[device.PlayerChannel2 - 1] = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -545,7 +503,7 @@ namespace Vocaluxe.Screens
|
||||
_DelayTestRunning = true;
|
||||
}
|
||||
|
||||
private void _GetFirstConfiguredRecordDevice(ref int device, ref int input)
|
||||
private void _GetFirstConfiguredRecordDevice(ref int device)
|
||||
{
|
||||
if (_Devices == null)
|
||||
return;
|
||||
@@ -553,22 +511,15 @@ namespace Vocaluxe.Screens
|
||||
if (CConfig.MicConfig == null)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < _Devices.Length; i++)
|
||||
if (CConfig.MicConfig[0].Channel <= 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < _Devices.Count; i++)
|
||||
{
|
||||
if (_Devices[i].Name == CConfig.MicConfig[0].DeviceName && _Devices[i].Driver == CConfig.MicConfig[0].DeviceDriver)
|
||||
{
|
||||
for (int j = 0; j < _Devices[i].Inputs.Count; j++)
|
||||
{
|
||||
if (_Devices[i].Inputs[j].Name == CConfig.MicConfig[0].InputName)
|
||||
{
|
||||
if (CConfig.MicConfig[0].Channel > 0)
|
||||
{
|
||||
device = i;
|
||||
input = j;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
device = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Base.Font;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Screens
|
||||
@@ -180,12 +180,7 @@ namespace Vocaluxe.Screens
|
||||
CConfig.SaveConfig();
|
||||
|
||||
if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Selection)
|
||||
{
|
||||
CCover.ReloadCover();
|
||||
CSongs.Filter.SearchString = String.Empty;
|
||||
CSongs.Sorter.SetOptions(CConfig.SongSorting, CConfig.IgnoreArticles);
|
||||
CSongs.Categorizer.Tabs = CConfig.Tabs;
|
||||
}
|
||||
|
||||
if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection)
|
||||
{
|
||||
|
||||
@@ -177,6 +177,13 @@ namespace Vocaluxe.Screens
|
||||
if (!_PartyModeInfos[index].Playable)
|
||||
{
|
||||
_Buttons[_ButtonStart].Visible = false;
|
||||
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR";
|
||||
_Texts[_TextError].Visible = true;
|
||||
}
|
||||
else if (CConfig.GetMaxNumMics() == 0)
|
||||
{
|
||||
_Buttons[_ButtonStart].Visible = false;
|
||||
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR_MICS";
|
||||
_Texts[_TextError].Visible = true;
|
||||
}
|
||||
else
|
||||
@@ -193,10 +200,12 @@ namespace Vocaluxe.Screens
|
||||
|
||||
int index = _SelectSlides[_SelectSlideModes].Selection;
|
||||
if (index >= _PartyModeInfos.Count)
|
||||
{
|
||||
_Buttons[_ButtonStart].Visible = false;
|
||||
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR";
|
||||
_Texts[_TextError].Visible = true;
|
||||
return;
|
||||
|
||||
if (CConfig.GetMaxNumMics() == 0)
|
||||
return; //TODO: Add message!
|
||||
}
|
||||
|
||||
CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID);
|
||||
CGraphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
|
||||
@@ -314,11 +314,9 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (_Snapshot == null)
|
||||
CWebcam.GetFrame(ref _WebcamTexture);
|
||||
_Statics[_StaticAvatar].Texture = _WebcamTexture;
|
||||
|
||||
RectangleF bounds = new RectangleF(_WebcamTexture.Rect.X, _WebcamTexture.Rect.Y, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H);
|
||||
RectangleF rect = new RectangleF(0f, 0f, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H);
|
||||
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
_Statics[_StaticAvatar].Aspect = EAspect.Crop;
|
||||
_Statics[_StaticAvatar].Texture = _WebcamTexture;
|
||||
}
|
||||
else
|
||||
_Statics[_StaticAvatar].Texture = CProfiles.Avatars[avatarNr].Texture;
|
||||
|
||||
@@ -127,31 +127,31 @@ namespace Vocaluxe.Screens
|
||||
|
||||
public override bool UpdateGame()
|
||||
{
|
||||
SPlayer[] player = new SPlayer[CGame.NumPlayer];
|
||||
SPlayer[] players = new SPlayer[CGame.NumPlayer];
|
||||
if (_Round != 0)
|
||||
player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
|
||||
players = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < CGame.NumRounds; i++)
|
||||
{
|
||||
SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer);
|
||||
for (int p = 0; p < player.Length; p++)
|
||||
player[p].Points += points[p].Points;
|
||||
for (int p = 0; p < players.Length; p++)
|
||||
players[p].Points += points[p].Points;
|
||||
}
|
||||
for (int p = 0; p < player.Length; p++)
|
||||
player[p].Points = (int)(player[p].Points / CGame.NumRounds);
|
||||
for (int p = 0; p < players.Length; p++)
|
||||
players[p].Points = (int)(players[p].Points / CGame.NumRounds);
|
||||
}
|
||||
for (int p = 0; p < player.Length; p++)
|
||||
for (int p = 0; p < players.Length; p++)
|
||||
{
|
||||
if (_StaticPointsBarDrawnPoints[p] < player[p].Points)
|
||||
if (_StaticPointsBarDrawnPoints[p] < players[p].Points)
|
||||
{
|
||||
if (CConfig.ScoreAnimationTime >= 1)
|
||||
{
|
||||
_StaticPointsBarDrawnPoints[p] = (_Timer.ElapsedMilliseconds / 1000f) / CConfig.ScoreAnimationTime * 10000;
|
||||
|
||||
|
||||
if (_StaticPointsBarDrawnPoints[p] > player[p].Points)
|
||||
_StaticPointsBarDrawnPoints[p] = player[p].Points;
|
||||
if (_StaticPointsBarDrawnPoints[p] > players[p].Points)
|
||||
_StaticPointsBarDrawnPoints[p] = players[p].Points;
|
||||
string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
|
||||
if (direction.ToLower() == "vertical")
|
||||
{
|
||||
@@ -260,7 +260,7 @@ namespace Vocaluxe.Screens
|
||||
private void _UpdateRatings()
|
||||
{
|
||||
CSong song = null;
|
||||
SPlayer[] player = new SPlayer[CGame.NumPlayer];
|
||||
SPlayer[] players = new SPlayer[CGame.NumPlayer];
|
||||
if (_Round != 0)
|
||||
{
|
||||
song = CGame.GetSong(_Round);
|
||||
@@ -270,7 +270,7 @@ namespace Vocaluxe.Screens
|
||||
_Texts[_TextSong].Text = song.Artist + " - " + song.Title;
|
||||
if (_Points.NumRounds > 1)
|
||||
_Texts[_TextSong].Text += " (" + _Round + "/" + _Points.NumRounds + ")";
|
||||
player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
|
||||
players = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -278,47 +278,47 @@ namespace Vocaluxe.Screens
|
||||
for (int i = 0; i < CGame.NumRounds; i++)
|
||||
{
|
||||
SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer);
|
||||
for (int p = 0; p < player.Length; p++)
|
||||
for (int p = 0; p < players.Length; p++)
|
||||
{
|
||||
if (i < 1)
|
||||
player[p].ProfileID = points[p].ProfileID;
|
||||
player[p].Points += points[p].Points;
|
||||
players[p].ProfileID = points[p].ProfileID;
|
||||
players[p].Points += points[p].Points;
|
||||
}
|
||||
}
|
||||
for (int p = 0; p < player.Length; p++)
|
||||
player[p].Points = (int)Math.Round(player[p].Points / CGame.NumRounds);
|
||||
for (int p = 0; p < players.Length; p++)
|
||||
players[p].Points = (int)Math.Round(players[p].Points / CGame.NumRounds);
|
||||
}
|
||||
|
||||
for (int p = 0; p < player.Length; p++)
|
||||
for (int p = 0; p < players.Length; p++)
|
||||
{
|
||||
string name = CProfiles.GetPlayerName(player[p].ProfileID, p);
|
||||
string name = CProfiles.GetPlayerName(players[p].ProfileID, p);
|
||||
if (song != null && song.IsDuet)
|
||||
{
|
||||
if (player[p].LineNr == 0 && song.DuetPart1 != "Part 1")
|
||||
if (players[p].LineNr == 0 && song.DuetPart1 != "Part 1")
|
||||
name += " (" + song.DuetPart1 + ")";
|
||||
else if (player[p].LineNr == 1 && song.DuetPart2 != "Part 2")
|
||||
else if (players[p].LineNr == 1 && song.DuetPart2 != "Part 2")
|
||||
name += " (" + song.DuetPart2 + ")";
|
||||
}
|
||||
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = name;
|
||||
|
||||
if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue())
|
||||
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS");
|
||||
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS");
|
||||
else
|
||||
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000");
|
||||
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000");
|
||||
if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue())
|
||||
{
|
||||
_Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " +
|
||||
CLanguage.Translate(CProfiles.GetDifficulty(player[p].ProfileID).ToString());
|
||||
CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
|
||||
}
|
||||
else
|
||||
_Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(player[p].ProfileID).ToString());
|
||||
_Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
|
||||
if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue())
|
||||
{
|
||||
_Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " +
|
||||
CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points)));
|
||||
CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
|
||||
}
|
||||
else
|
||||
_Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points)));
|
||||
_Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
|
||||
|
||||
_StaticPointsBarDrawnPoints[p] = 0.0;
|
||||
string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
|
||||
@@ -331,19 +331,19 @@ namespace Vocaluxe.Screens
|
||||
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
|
||||
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
|
||||
}
|
||||
if (CProfiles.IsProfileIDValid(player[p].ProfileID))
|
||||
_Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture;
|
||||
if (CProfiles.IsProfileIDValid(players[p].ProfileID))
|
||||
_Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[players[p].ProfileID].Avatar.Texture;
|
||||
}
|
||||
|
||||
if (CConfig.ScoreAnimationTime < 1)
|
||||
{
|
||||
for (int p = 0; p < CGame.NumPlayer; p++)
|
||||
{
|
||||
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)player[p].Points) * (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000);
|
||||
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)players[p].Points) * (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000);
|
||||
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H +
|
||||
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
|
||||
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
|
||||
_StaticPointsBarDrawnPoints[p] = player[p].Points;
|
||||
_StaticPointsBarDrawnPoints[p] = players[p].Points;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Base.Font;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SingNotes;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
@@ -383,7 +384,9 @@ namespace Vocaluxe.Screens
|
||||
|
||||
for (int p = 0; p < CGame.NumPlayer; p++)
|
||||
{
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (CGame.Players[p].Points < 10000)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString("0000");
|
||||
else
|
||||
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString("00000");
|
||||
@@ -450,8 +453,6 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (_Active)
|
||||
{
|
||||
_UpdateMedleyCountdown();
|
||||
|
||||
if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
|
||||
@@ -517,12 +518,15 @@ namespace Vocaluxe.Screens
|
||||
_DrawLyricHelper();
|
||||
|
||||
if (CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY)
|
||||
{
|
||||
_UpdateMedleyCountdown();
|
||||
_Texts[_TextMedleyCountdown].Draw();
|
||||
}
|
||||
|
||||
if (_Pause)
|
||||
{
|
||||
_Statics[_StaticPauseBG].ForceDraw();
|
||||
_Texts[_TextPause].ForceDraw();
|
||||
_Statics[_StaticPauseBG].Draw(true);
|
||||
_Texts[_TextPause].Draw(true);
|
||||
|
||||
foreach (CButton button in _Buttons)
|
||||
button.Draw();
|
||||
@@ -647,6 +651,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
}
|
||||
_SetDuetLyricsVisibility(song.IsDuet);
|
||||
_SetNormalLyricsVisibility();
|
||||
|
||||
for (int p = 0; p < CGame.NumPlayer; p++)
|
||||
_NoteLines[p] = _SingNotes[_SingBars].AddPlayer(_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], CTheme.GetPlayerColor(p + 1), p);
|
||||
@@ -686,13 +691,23 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
else
|
||||
{
|
||||
bool lyricsOnTop = (CGame.NumPlayer != 1) && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON;
|
||||
bool lyricsOnTop = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP
|
||||
|| CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|
||||
|| (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && (CGame.NumPlayer > 2 && CGame.NumPlayer != 4));
|
||||
_Lyrics[_LyricMainTop].Visible = lyricsOnTop;
|
||||
_Lyrics[_LyricSubTop].Visible = lyricsOnTop;
|
||||
_Statics[_StaticLyricsTop].Visible = lyricsOnTop;
|
||||
}
|
||||
}
|
||||
|
||||
private void _SetNormalLyricsVisibility()
|
||||
{
|
||||
bool visible = CConfig.LyricsPosition != ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP;
|
||||
_Lyrics[_LyricMain].Visible = visible;
|
||||
_Lyrics[_LyricSub].Visible = visible;
|
||||
_Statics[_StaticLyrics].Visible = visible;
|
||||
}
|
||||
|
||||
private void _StartSong()
|
||||
{
|
||||
_PrepareTimeLine();
|
||||
@@ -948,28 +963,27 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _UpdateMedleyCountdown()
|
||||
{
|
||||
if (CGame.GetSong() != null)
|
||||
CSong song = CGame.GetSong();
|
||||
if (song == null)
|
||||
return;
|
||||
float timeToFirstMedleyNote = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) + song.Gap;
|
||||
if (_CurrentTime < timeToFirstMedleyNote)
|
||||
{
|
||||
CSong song = CGame.GetSong();
|
||||
float currentTime = _CurrentTime - song.Start;
|
||||
float timeToFirstMedleyNote = (CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) + song.Gap - song.Start);
|
||||
if (currentTime < timeToFirstMedleyNote && CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY)
|
||||
{
|
||||
float timeDiff = timeToFirstMedleyNote - currentTime + 1;
|
||||
double t = timeDiff - Math.Truncate(timeDiff);
|
||||
_Texts[_TextMedleyCountdown].Visible = true;
|
||||
_Texts[_TextMedleyCountdown].Text = Math.Round((decimal)(timeDiff - t)).ToString();
|
||||
float h = (float)(t * CSettings.RenderH);
|
||||
float w = CFonts.GetTextBounds(_Texts[_TextMedleyCountdown], h).Width;
|
||||
float x = CSettings.RenderW / 2 - w / 2;
|
||||
float y = CSettings.RenderH / 2 - h / 2;
|
||||
_Texts[_TextMedleyCountdown].X = x;
|
||||
_Texts[_TextMedleyCountdown].Y = y;
|
||||
_Texts[_TextMedleyCountdown].Height = h;
|
||||
}
|
||||
else
|
||||
_Texts[_TextMedleyCountdown].Visible = false;
|
||||
float timeDiff = timeToFirstMedleyNote - _CurrentTime + 1;
|
||||
float fullSeconds = (float)Math.Truncate(timeDiff);
|
||||
float partSeconds = timeDiff - fullSeconds;
|
||||
_Texts[_TextMedleyCountdown].Visible = true;
|
||||
_Texts[_TextMedleyCountdown].Text = fullSeconds.ToString();
|
||||
float h = partSeconds * CSettings.RenderH;
|
||||
float w = CFonts.GetTextBounds(_Texts[_TextMedleyCountdown], h).Width;
|
||||
float x = CSettings.RenderW / 2 - w / 2;
|
||||
float y = CSettings.RenderH / 2 - h / 2;
|
||||
_Texts[_TextMedleyCountdown].X = x;
|
||||
_Texts[_TextMedleyCountdown].Y = y;
|
||||
_Texts[_TextMedleyCountdown].Height = h;
|
||||
}
|
||||
else
|
||||
_Texts[_TextMedleyCountdown].Visible = false;
|
||||
}
|
||||
|
||||
private void _DrawLyricHelper()
|
||||
@@ -998,27 +1012,30 @@ namespace Vocaluxe.Screens
|
||||
if (time > totaltime)
|
||||
time = totaltime;
|
||||
|
||||
SRectF rect = _Statics[_StaticLyricHelper].Rect;
|
||||
SColorF color = new SColorF(
|
||||
_Statics[_StaticLyricHelper].Color.R,
|
||||
_Statics[_StaticLyricHelper].Color.G,
|
||||
_Statics[_StaticLyricHelper].Color.B,
|
||||
_Statics[_StaticLyricHelper].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha);
|
||||
if (_Statics[_StaticLyrics].Visible)
|
||||
{
|
||||
SRectF rect = _Statics[_StaticLyricHelper].Rect;
|
||||
SColorF color = new SColorF(
|
||||
_Statics[_StaticLyricHelper].Color.R,
|
||||
_Statics[_StaticLyricHelper].Color.G,
|
||||
_Statics[_StaticLyricHelper].Color.B,
|
||||
_Statics[_StaticLyricHelper].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha);
|
||||
|
||||
float distance = _Lyrics[_LyricMain].GetCurrentLyricPosX() - rect.X - rect.W;
|
||||
CDraw.DrawTexture(_Statics[_StaticLyricHelper].Texture,
|
||||
new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color);
|
||||
float distance = _Lyrics[_LyricMain].GetCurrentLyricPosX() - rect.X - rect.W;
|
||||
CDraw.DrawTexture(_Statics[_StaticLyricHelper].Texture,
|
||||
new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color);
|
||||
}
|
||||
|
||||
if (_Statics[_StaticLyricsTop].Visible)
|
||||
{
|
||||
rect = _Statics[_StaticLyricHelperTop].Rect;
|
||||
color = new SColorF(
|
||||
SRectF rect = _Statics[_StaticLyricHelperTop].Rect;
|
||||
SColorF color = new SColorF(
|
||||
_Statics[_StaticLyricHelperTop].Color.R,
|
||||
_Statics[_StaticLyricHelperTop].Color.G,
|
||||
_Statics[_StaticLyricHelperTop].Color.B,
|
||||
_Statics[_StaticLyricHelperTop].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha);
|
||||
|
||||
distance = _Lyrics[_LyricMainTop].GetCurrentLyricPosX() - rect.X - rect.W;
|
||||
float distance = _Lyrics[_LyricMainTop].GetCurrentLyricPosX() - rect.X - rect.W;
|
||||
CDraw.DrawTexture(_Statics[_StaticLyricHelperTop].Texture,
|
||||
new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using VocaluxeLib.Menu;
|
||||
@@ -213,7 +214,7 @@ namespace Vocaluxe.Screens
|
||||
if (_Buttons[_ButtonStart].Selected)
|
||||
_HandlePartySongSelection(_SongMenus[_SongMenu].GetSelectedSong());
|
||||
}
|
||||
if (CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode)
|
||||
if (CSongs.NumSongsVisible > 0 && !_Sso.Selection.PartyMode)
|
||||
{
|
||||
if (_SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive)
|
||||
{
|
||||
@@ -276,7 +277,7 @@ namespace Vocaluxe.Screens
|
||||
break;
|
||||
|
||||
case Keys.S:
|
||||
if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode)
|
||||
if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumSongsVisible > 0 && !_Sso.Selection.PartyMode)
|
||||
_StartMedleySong(_SongMenus[_SongMenu].GetSelectedSong());
|
||||
break;
|
||||
|
||||
@@ -338,7 +339,9 @@ namespace Vocaluxe.Screens
|
||||
else if (_Buttons[_ButtonOptionsOpenSelectedItem].Selected)
|
||||
_HandleSelectButton();
|
||||
else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selected)
|
||||
_OpenPlaylistAction();
|
||||
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection);
|
||||
else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selected)
|
||||
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1);
|
||||
else if (_Buttons[_ButtonOptionsRandomMedley].Selected)
|
||||
_ToggleSongOptions(ESongOptionsView.Medley);
|
||||
else if (_Buttons[_ButtonOptionsStartMedley].Selected)
|
||||
@@ -440,7 +443,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
//TODO: Causes Bug if you select a song (e.g. with Select random song) and double click a normal button.
|
||||
//E.g. clicking to fast on Select random song starts the next random song. is this OK?
|
||||
if (CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
|
||||
if (CSongs.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
|
||||
{
|
||||
_ToggleSongOptions(ESongOptionsView.None);
|
||||
_StartVisibleSong(_SongMenus[_SongMenu].GetActualSelection());
|
||||
@@ -515,7 +518,12 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected)
|
||||
{
|
||||
_OpenPlaylistAction();
|
||||
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection);
|
||||
return true;
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].ValueSelected)
|
||||
{
|
||||
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1);
|
||||
return true;
|
||||
}
|
||||
else if (_Buttons[_ButtonOptionsRandomMedley].Selected)
|
||||
@@ -551,7 +559,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
}
|
||||
|
||||
if (CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1 && !_Sso.Selection.PartyMode)
|
||||
if (CSongs.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1 && !_Sso.Selection.PartyMode)
|
||||
{
|
||||
if (_SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive)
|
||||
{
|
||||
@@ -565,7 +573,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
if (mouseEvent.LBH)
|
||||
{
|
||||
if (!_DragAndDropActive && _Playlists[_Playlist].Visible && CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
|
||||
if (!_DragAndDropActive && _Playlists[_Playlist].Visible && CSongs.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
|
||||
{
|
||||
_DragAndDropCover = _SongMenus[_SongMenu].GetSelectedSongCover();
|
||||
_DragAndDropCover.Rect.Z = CSettings.ZNear;
|
||||
@@ -612,7 +620,7 @@ namespace Vocaluxe.Screens
|
||||
_SearchActive = _Sso.Sorting.SearchActive;
|
||||
_SearchText = _Sso.Sorting.SearchString;
|
||||
|
||||
CGame.EnterNormalGame();
|
||||
CGame.Reset();
|
||||
_SongMenus[_SongMenu].OnShow();
|
||||
|
||||
if (_Sso.Selection.PartyMode)
|
||||
@@ -646,9 +654,9 @@ namespace Vocaluxe.Screens
|
||||
CBackgroundMusic.Disabled = false;
|
||||
|
||||
int song = _SongMenus[_SongMenu].GetActualSelection();
|
||||
if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Length)
|
||||
if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Count)
|
||||
_Texts[_TextSelection].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title;
|
||||
else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Length)
|
||||
else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Count)
|
||||
_Texts[_TextSelection].Text = CSongs.Categories[song].Name;
|
||||
else
|
||||
_Texts[_TextSelection].Text = String.Empty;
|
||||
@@ -815,7 +823,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _StartVisibleSong(int songNr)
|
||||
{
|
||||
if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumVisibleSongs > songNr)
|
||||
if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumSongsVisible > songNr)
|
||||
{
|
||||
EGameMode gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
|
||||
|
||||
@@ -832,15 +840,12 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if ((CSongs.Category >= 0) && (songNr >= 0))
|
||||
{
|
||||
EGameMode gm;
|
||||
if (CSongs.VisibleSongs[songNr].Medley.Source != EMedleySource.None)
|
||||
gm = EGameMode.TR_GAMEMODE_MEDLEY;
|
||||
else
|
||||
if (CSongs.VisibleSongs[songNr].Medley.Source == EMedleySource.None)
|
||||
return;
|
||||
|
||||
CGame.Reset();
|
||||
CGame.ClearSongs();
|
||||
CGame.AddVisibleSong(songNr, gm);
|
||||
CGame.AddVisibleSong(songNr, EGameMode.TR_GAMEMODE_MEDLEY);
|
||||
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
}
|
||||
@@ -852,7 +857,7 @@ namespace Vocaluxe.Screens
|
||||
CGame.ClearSongs();
|
||||
|
||||
List<int> ids = new List<int>();
|
||||
for (int i = 0; i < CSongs.AllSongs.Length; i++)
|
||||
for (int i = 0; i < CSongs.AllSongs.Count; i++)
|
||||
ids.Add(i);
|
||||
|
||||
while (ids.Count > 0)
|
||||
@@ -878,7 +883,7 @@ namespace Vocaluxe.Screens
|
||||
CGame.ClearSongs();
|
||||
|
||||
List<int> ids = new List<int>();
|
||||
for (int i = 0; i < CSongs.VisibleSongs.Length; i++)
|
||||
for (int i = 0; i < CSongs.VisibleSongs.Count; i++)
|
||||
ids.Add(CSongs.VisibleSongs[i].ID);
|
||||
|
||||
while (ids.Count > 0)
|
||||
@@ -906,12 +911,12 @@ namespace Vocaluxe.Screens
|
||||
List<int> ids = new List<int>();
|
||||
if (allSongs)
|
||||
{
|
||||
for (int i = 0; i < CSongs.AllSongs.Length; i++)
|
||||
for (int i = 0; i < CSongs.AllSongs.Count; i++)
|
||||
ids.Add(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < CSongs.VisibleSongs.Length; i++)
|
||||
for (int i = 0; i < CSongs.VisibleSongs.Count; i++)
|
||||
ids.Add(CSongs.VisibleSongs[i].ID);
|
||||
}
|
||||
int s = 0;
|
||||
@@ -981,6 +986,21 @@ namespace Vocaluxe.Screens
|
||||
return false;
|
||||
}
|
||||
|
||||
private int _FindIndex<T>(IList<T> list, int start, Predicate<T> match)
|
||||
{
|
||||
for (int i = start; i < list.Count; i++)
|
||||
{
|
||||
if (match(list[i]))
|
||||
return i;
|
||||
}
|
||||
for (int i = 0; i < start; i++)
|
||||
{
|
||||
if (match(list[i]))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void _JumpTo(char letter)
|
||||
{
|
||||
int start = 0;
|
||||
@@ -988,29 +1008,21 @@ namespace Vocaluxe.Screens
|
||||
if (CSongs.IsInCategory)
|
||||
{
|
||||
//TODO: Check and use sorting method
|
||||
CSong[] songs = CSongs.VisibleSongs;
|
||||
int ct = songs.Length;
|
||||
if (curSelected >= 0 && curSelected < ct - 1)
|
||||
{
|
||||
CSong currentSong = CSongs.GetVisibleSongByIndex(curSelected);
|
||||
if (currentSong != null && currentSong.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
}
|
||||
int visibleID = Array.FindIndex(songs, start, ct - start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
if (visibleID < 0 && start > 1)
|
||||
visibleID = Array.FindIndex(songs, 0, start - 1, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs;
|
||||
int ct = songs.Count;
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
int visibleID = _FindIndex(songs, start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
if (visibleID > -1)
|
||||
_SongMenus[_SongMenu].SetSelectedSong(visibleID);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCategory[] categories = CSongs.Categories;
|
||||
int ct = categories.Length;
|
||||
ReadOnlyCollection<CCategory> categories = CSongs.Categories;
|
||||
int ct = categories.Count;
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && categories[curSelected].Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
start = curSelected + 1;
|
||||
int visibleID = Array.FindIndex(categories, start, ct - start, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
if (visibleID < 0 && start > 1)
|
||||
visibleID = Array.FindIndex(categories, 0, start - 1, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
int visibleID = _FindIndex(categories, start, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
if (visibleID > -1)
|
||||
_SongMenus[_SongMenu].SetSelectedCategory(visibleID);
|
||||
}
|
||||
@@ -1026,7 +1038,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
int songIndex = _SongMenus[_SongMenu].GetSelectedSong();
|
||||
int songID = -1;
|
||||
if (songIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > songIndex)
|
||||
if (songIndex != -1 && CSongs.NumSongsVisible > 0 && CSongs.NumSongsVisible > songIndex)
|
||||
songID = CSongs.VisibleSongs[songIndex].ID;
|
||||
|
||||
if (newFilterString == "" && _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
@@ -1043,7 +1055,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, newFilterString, _Sso.Sorting.DuetOptions);
|
||||
|
||||
if (songID == -1 || CSongs.NumVisibleSongs == 0 || CSongs.NumVisibleSongs <= songIndex || CSongs.GetVisibleSongByIndex(songIndex).ID != songID)
|
||||
if (songID == -1 || CSongs.NumSongsVisible == 0 || CSongs.NumSongsVisible <= songIndex || CSongs.GetVisibleSongByIndex(songIndex).ID != songID)
|
||||
refresh = true;
|
||||
|
||||
if (refresh)
|
||||
@@ -1097,7 +1109,6 @@ namespace Vocaluxe.Screens
|
||||
EGameMode lastMode = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
if (_AvailableGameModes.Count > 0)
|
||||
lastMode = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
|
||||
_SetInteractionToButton(_Buttons[_ButtonOptionsSing]);
|
||||
_AvailableGameModes.Clear();
|
||||
_SelectSlides[_SelectSlideOptionsMode].Clear();
|
||||
if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet)
|
||||
@@ -1146,7 +1157,9 @@ namespace Vocaluxe.Screens
|
||||
if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].NumValues > 0)
|
||||
_SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = true;
|
||||
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (_Buttons[_ButtonOptionsRandom].Visible)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
_SetInteractionToButton(_Buttons[_ButtonOptionsRandom]);
|
||||
else
|
||||
_SetInteractionToButton(_Buttons[_ButtonOptionsRandomCategory]);
|
||||
@@ -1159,12 +1172,12 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlides[_SelectSlideOptionsNumMedleySongs].Clear();
|
||||
if (CSongs.IsInCategory)
|
||||
{
|
||||
for (int i = 1; i <= CSongs.VisibleSongs.Length; i++)
|
||||
for (int i = 1; i <= CSongs.VisibleSongs.Count; i++)
|
||||
_SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i <= CSongs.AllSongs.Length; i++)
|
||||
for (int i = 1; i <= CSongs.AllSongs.Count; i++)
|
||||
_SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString());
|
||||
}
|
||||
if (_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5)
|
||||
@@ -1183,11 +1196,12 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _OpenPlaylist(int playlistID)
|
||||
{
|
||||
if (CPlaylists.Playlists.Length > playlistID && playlistID > -1)
|
||||
if (CPlaylists.Playlists.Length > playlistID && playlistID >= 0 && _Playlists[_Playlist].ActivePlaylistID != playlistID)
|
||||
{
|
||||
_Playlists[_Playlist].LoadPlaylist(playlistID);
|
||||
_SongMenus[_SongMenu].SetSmallView(true);
|
||||
_Playlists[_Playlist].Visible = true;
|
||||
_SetSelectSlidePlaylistToCurrentPlaylist();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1212,19 +1226,6 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames);
|
||||
}
|
||||
|
||||
private void _OpenPlaylistAction()
|
||||
{
|
||||
//Open a playlist
|
||||
if (_Playlists[_Playlist].ActivePlaylistID != _SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection)
|
||||
{
|
||||
_Playlists[_Playlist].ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection;
|
||||
_SetSelectSlidePlaylistToCurrentPlaylist();
|
||||
|
||||
//Open playlist
|
||||
_OpenPlaylist(_Playlists[_Playlist].ActivePlaylistID);
|
||||
}
|
||||
}
|
||||
|
||||
private void _OpenAndAddPlaylistAction()
|
||||
{
|
||||
//Open an existing playlist and add song
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
#region license
|
||||
// /*
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.GameModes;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
|
||||
namespace Vocaluxe.SongQueue
|
||||
{
|
||||
struct SSongQueueEntry
|
||||
{
|
||||
public readonly int SongID;
|
||||
public readonly EGameMode GameMode;
|
||||
|
||||
public SSongQueueEntry(int songID, EGameMode gameMode)
|
||||
{
|
||||
SongID = songID;
|
||||
GameMode = gameMode;
|
||||
}
|
||||
}
|
||||
|
||||
class CSongQueue : ISongQueue
|
||||
{
|
||||
private List<SSongQueueEntry> _SongQueue;
|
||||
private int _CurrentSong;
|
||||
private CPoints _Points;
|
||||
|
||||
#region Implementation
|
||||
public void Init()
|
||||
{
|
||||
_SongQueue = new List<SSongQueueEntry>();
|
||||
Reset();
|
||||
CGameModes.Init();
|
||||
}
|
||||
|
||||
public EGameMode GetCurrentGameMode()
|
||||
{
|
||||
if (_CurrentSong >= 0 && _CurrentSong < _SongQueue.Count)
|
||||
return _SongQueue[_CurrentSong].GameMode;
|
||||
return EGameMode.TR_GAMEMODE_NORMAL;
|
||||
}
|
||||
|
||||
public bool AddVisibleSong(int visibleIndex, EGameMode gameMode)
|
||||
{
|
||||
return CSongs.VisibleSongs.Count > visibleIndex && _AddSong(CSongs.VisibleSongs[visibleIndex].ID, gameMode);
|
||||
}
|
||||
|
||||
public bool AddSong(int absoluteIndex, EGameMode gameMode)
|
||||
{
|
||||
return CSongs.AllSongs.Count > absoluteIndex && _AddSong(CSongs.AllSongs[absoluteIndex].ID, gameMode);
|
||||
}
|
||||
|
||||
private bool _AddSong(int songID, EGameMode gameMode)
|
||||
{
|
||||
if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet)
|
||||
return false;
|
||||
|
||||
_SongQueue.Add(new SSongQueueEntry(songID, gameMode));
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool RemoveVisibleSong(int visibleIndex)
|
||||
{
|
||||
return CSongs.VisibleSongs.Count > visibleIndex && _RemoveSong(CSongs.VisibleSongs[visibleIndex].ID);
|
||||
}
|
||||
|
||||
public bool RemoveSong(int absoluteIndex)
|
||||
{
|
||||
return CSongs.AllSongs.Count > absoluteIndex && _RemoveSong(CSongs.AllSongs[absoluteIndex].ID);
|
||||
}
|
||||
|
||||
private bool _RemoveSong(int songID)
|
||||
{
|
||||
for (int i = 0; i < _SongQueue.Count; i++)
|
||||
{
|
||||
if (_SongQueue[i].SongID != songID)
|
||||
continue;
|
||||
_SongQueue.RemoveAt(i);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearSongs()
|
||||
{
|
||||
_SongQueue.Clear();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_CurrentSong = -1;
|
||||
}
|
||||
|
||||
public void Start(SPlayer[] players)
|
||||
{
|
||||
_Points = new CPoints(_SongQueue.Count, players);
|
||||
}
|
||||
|
||||
public void NextRound(SPlayer[] players)
|
||||
{
|
||||
if (_CurrentSong < _SongQueue.Count && _SongQueue.Count > 0)
|
||||
{
|
||||
if (_CurrentSong > -1)
|
||||
{
|
||||
_Points.SetPoints(
|
||||
_CurrentSong,
|
||||
_SongQueue[_CurrentSong].SongID,
|
||||
players,
|
||||
_SongQueue[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_MEDLEY,
|
||||
_SongQueue[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_DUET,
|
||||
_SongQueue[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_SHORTSONG);
|
||||
}
|
||||
_CurrentSong++;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFinished()
|
||||
{
|
||||
return _CurrentSong == _SongQueue.Count || _SongQueue.Count == 0;
|
||||
}
|
||||
|
||||
public int GetCurrentRoundNr()
|
||||
{
|
||||
return _CurrentSong + 1;
|
||||
}
|
||||
|
||||
public CSong GetSong()
|
||||
{
|
||||
if (_CurrentSong >= 0 && _CurrentSong < _SongQueue.Count)
|
||||
return CGameModes.Get(_SongQueue[_CurrentSong].GameMode).GetSong(_SongQueue[_CurrentSong].SongID);
|
||||
return null;
|
||||
}
|
||||
|
||||
public int GetNumSongs()
|
||||
{
|
||||
return _SongQueue.Count;
|
||||
}
|
||||
|
||||
public CSong GetSong(int num)
|
||||
{
|
||||
if (num - 1 < _SongQueue.Count && num > 0)
|
||||
return CSongs.GetSong(_SongQueue[num - 1].SongID);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public EGameMode GetGameMode(int num)
|
||||
{
|
||||
if (num - 1 < _SongQueue.Count && num > 0)
|
||||
return _SongQueue[num - 1].GameMode;
|
||||
|
||||
return EGameMode.TR_GAMEMODE_NORMAL;
|
||||
}
|
||||
|
||||
public CPoints GetPoints()
|
||||
{
|
||||
return _Points;
|
||||
}
|
||||
#endregion Implementation
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,34 @@
|
||||
// */
|
||||
#endregion
|
||||
|
||||
namespace Vocaluxe.GameModes
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
|
||||
namespace Vocaluxe.SongQueue
|
||||
{
|
||||
// Nomal singing
|
||||
class CGameModeNormal : CGameMode {}
|
||||
interface ISongQueue
|
||||
{
|
||||
void Init();
|
||||
|
||||
EGameMode GetCurrentGameMode();
|
||||
|
||||
bool AddVisibleSong(int visibleIndex, EGameMode gameMode);
|
||||
bool AddSong(int absoluteIndex, EGameMode gameMode);
|
||||
bool RemoveVisibleSong(int visibleIndex);
|
||||
bool RemoveSong(int absoluteIndex);
|
||||
void ClearSongs();
|
||||
|
||||
void Reset();
|
||||
void Start(SPlayer[] players);
|
||||
void NextRound(SPlayer[] players);
|
||||
bool IsFinished();
|
||||
int GetCurrentRoundNr();
|
||||
|
||||
CPoints GetPoints();
|
||||
|
||||
int GetNumSongs();
|
||||
CSong GetSong();
|
||||
CSong GetSong(int num);
|
||||
EGameMode GetGameMode(int num);
|
||||
}
|
||||
}
|
||||
@@ -176,9 +176,9 @@
|
||||
<Compile Include="Base\CCover.cs" />
|
||||
<Compile Include="Base\CDataBase.cs" />
|
||||
<Compile Include="Base\CDraw.cs" />
|
||||
<Compile Include="Base\CFont.cs" />
|
||||
<Compile Include="Base\Font\CFont.cs" />
|
||||
<Compile Include="Base\CGame.cs" />
|
||||
<Compile Include="Base\CInput.cs" />
|
||||
<Compile Include="Base\CController.cs" />
|
||||
<Compile Include="Base\CLanguage.cs" />
|
||||
<Compile Include="Base\CLog.cs" />
|
||||
<Compile Include="Base\CMain.cs" />
|
||||
@@ -195,12 +195,16 @@
|
||||
<Compile Include="Base\CTheme.cs" />
|
||||
<Compile Include="Base\CVideo.cs" />
|
||||
<Compile Include="Base\CWebcam.cs" />
|
||||
<Compile Include="Base\Font\CFonts.cs" />
|
||||
<Compile Include="Base\Font\CGlyph.cs" />
|
||||
<Compile Include="CSplashScreen.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GameModes\CGameMode.cs" />
|
||||
<Compile Include="GameModes\CGameModeNormal.cs" />
|
||||
<Compile Include="GameModes\CGameModes.cs" />
|
||||
<Compile Include="SongQueue\CSongQueue.cs" />
|
||||
<Compile Include="GameModes\IGameMode.cs" />
|
||||
<Compile Include="SongQueue\ISongQueue.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="Lib\Draw\CDirect3D.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -213,7 +217,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Lib\Draw\IDraw.cs" />
|
||||
<Compile Include="Lib\Input\CHIDAPI.cs" />
|
||||
<Compile Include="Lib\Input\IInput.cs" />
|
||||
<Compile Include="Lib\Input\IController.cs" />
|
||||
<Compile Include="Lib\Input\WiiMote\CWiiMote.cs" />
|
||||
<Compile Include="Lib\Input\WiiMote\WiiMoteLib.cs" />
|
||||
<Compile Include="Lib\Playlist\CPlaylistFile.cs" />
|
||||
|
||||
@@ -38,12 +38,12 @@ namespace VocaluxeLib.Menu
|
||||
public static ISound Sound;
|
||||
public static ICover Cover;
|
||||
public static IDataBase DataBase;
|
||||
public static IInputs Input;
|
||||
public static IControllers Controller;
|
||||
public static IPlaylist Playlist;
|
||||
|
||||
public static void Assign(IConfig config, ISettings settings, ITheme theme, ILog log, IBackgroundMusic backgroundMusic,
|
||||
IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record,
|
||||
ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IInputs input, IPlaylist playlist)
|
||||
ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IControllers controller, IPlaylist playlist)
|
||||
{
|
||||
Config = config;
|
||||
Settings = settings;
|
||||
@@ -62,7 +62,7 @@ namespace VocaluxeLib.Menu
|
||||
Sound = sound;
|
||||
Cover = cover;
|
||||
DataBase = dataBase;
|
||||
Input = input;
|
||||
Controller = controller;
|
||||
Playlist = playlist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,23 @@ namespace VocaluxeLib.Menu
|
||||
Selection = -1;
|
||||
}
|
||||
|
||||
public void KeyboardSelection(bool active, int player)
|
||||
public void HandleMouse(SMouseEvent mevent)
|
||||
{
|
||||
for (int i = 0; i < _Tiles.Count; i++ )
|
||||
{
|
||||
if (CHelper.IsInBounds(_Tiles[i].Avatar.Rect, mevent))
|
||||
{
|
||||
_ActualSelection = i;
|
||||
|
||||
if (Offset * _Tiles.Count + _ActualSelection < _VisibleProfiles.Count)
|
||||
Selection = _VisibleProfiles[Offset * _Tiles.Count + _ActualSelection];
|
||||
else
|
||||
Selection = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FastSelection(bool active, int player)
|
||||
{
|
||||
//Overwrite player-selection; Same profile, but other player
|
||||
if (active && Selection != -1)
|
||||
|
||||
@@ -297,7 +297,9 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (_TextureName != "")
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
CBase.Drawing.DrawTexture(CBase.Theme.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
|
||||
else
|
||||
CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
|
||||
|
||||
@@ -1138,8 +1138,8 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
if (playlistID > -1 && playlistID < CBase.Playlist.GetNumPlaylists())
|
||||
{
|
||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
||||
ActivePlaylistID = playlistID;
|
||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
||||
_PlaylistElementContents.Clear();
|
||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
||||
{
|
||||
|
||||
+14
-14
@@ -80,23 +80,23 @@ namespace VocaluxeLib.Menu
|
||||
if (round >= NumRounds)
|
||||
return new SPlayer[1];
|
||||
|
||||
SPlayer[] player = new SPlayer[numPlayer];
|
||||
SPlayer[] players = new SPlayer[numPlayer];
|
||||
|
||||
for (int p = 0; p < player.Length; p++)
|
||||
for (int p = 0; p < players.Length; p++)
|
||||
{
|
||||
player[p].Points = _Rounds[round, p].Points;
|
||||
player[p].PointsGoldenNotes = _Rounds[round, p].PointsGoldenNotes;
|
||||
player[p].PointsLineBonus = _Rounds[round, p].PointsLineBonus;
|
||||
player[p].SongID = _Rounds[round, p].SongID;
|
||||
player[p].LineNr = _Rounds[round, p].LineNr;
|
||||
player[p].Medley = _Rounds[round, p].Medley;
|
||||
player[p].Duet = _Rounds[round, p].Duet;
|
||||
player[p].ShortSong = _Rounds[round, p].ShortSong;
|
||||
player[p].DateTicks = _Rounds[round, p].DateTicks;
|
||||
player[p].SongFinished = _Rounds[round, p].SongFinished;
|
||||
player[p].ProfileID = _Rounds[round, p].ProfileID;
|
||||
players[p].Points = _Rounds[round, p].Points;
|
||||
players[p].PointsGoldenNotes = _Rounds[round, p].PointsGoldenNotes;
|
||||
players[p].PointsLineBonus = _Rounds[round, p].PointsLineBonus;
|
||||
players[p].SongID = _Rounds[round, p].SongID;
|
||||
players[p].LineNr = _Rounds[round, p].LineNr;
|
||||
players[p].Medley = _Rounds[round, p].Medley;
|
||||
players[p].Duet = _Rounds[round, p].Duet;
|
||||
players[p].ShortSong = _Rounds[round, p].ShortSong;
|
||||
players[p].DateTicks = _Rounds[round, p].DateTicks;
|
||||
players[p].SongFinished = _Rounds[round, p].SongFinished;
|
||||
players[p].ProfileID = _Rounds[round, p].ProfileID;
|
||||
}
|
||||
return player;
|
||||
return players;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,27 +221,22 @@ namespace VocaluxeLib.Menu
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
public void Draw(bool forceDraw = false)
|
||||
{
|
||||
Draw(1f, Rect.Z, Aspect, false);
|
||||
Draw(1f, Rect.Z, Aspect, forceDraw);
|
||||
}
|
||||
|
||||
public void Draw(EAspect aspect)
|
||||
{
|
||||
Draw(1f, Rect.Z, aspect, false);
|
||||
Draw(1f, Rect.Z, aspect);
|
||||
}
|
||||
|
||||
public void Draw(float scale, EAspect aspect)
|
||||
{
|
||||
Draw(scale, Rect.Z, aspect, false);
|
||||
Draw(scale, Rect.Z, aspect);
|
||||
}
|
||||
|
||||
public void ForceDraw()
|
||||
{
|
||||
Draw(1f, Rect.Z, Aspect, true);
|
||||
}
|
||||
|
||||
public void Draw(float scale, float z, EAspect aspect, bool forceDraw)
|
||||
public void Draw(float scale, float z, EAspect aspect, bool forceDraw = false)
|
||||
{
|
||||
STexture texture = _Texture.Index != -1 ? _Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
|
||||
|
||||
|
||||
@@ -127,7 +127,9 @@ namespace VocaluxeLib.Menu
|
||||
if (Math.Abs(_MaxWidth - value) > 0.01)
|
||||
{
|
||||
_MaxWidth = value;
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (_MaxWidth > 0)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), _MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
else
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
@@ -332,7 +334,9 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
Selected = false;
|
||||
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (MaxWidth > 0)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
else
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
@@ -367,7 +371,9 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
Selected = false;
|
||||
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (MaxWidth > 0)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
else
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
@@ -400,7 +406,9 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
Selected = false;
|
||||
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (MaxWidth > 0)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
else
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
@@ -435,7 +443,9 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
Selected = false;
|
||||
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (MaxWidth > 0)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
else
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
@@ -509,7 +519,9 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
LoadTextures();
|
||||
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (MaxWidth > 0)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
else
|
||||
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
|
||||
@@ -601,11 +613,6 @@ namespace VocaluxeLib.Menu
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ForceDraw()
|
||||
{
|
||||
Draw(true);
|
||||
}
|
||||
|
||||
public void Draw(bool forceDraw = false)
|
||||
{
|
||||
if (!forceDraw && !Visible && CBase.Settings.GetGameState() != EGameState.EditTheme)
|
||||
|
||||
+10
-10
@@ -93,16 +93,6 @@ namespace VocaluxeLib.Menu
|
||||
X32 = 32
|
||||
}
|
||||
|
||||
public enum EColorDepth
|
||||
{
|
||||
// ReSharper disable UnusedMember.Global
|
||||
Bit8 = 8,
|
||||
Bit16 = 16,
|
||||
Bit24 = 24,
|
||||
Bit32 = 32
|
||||
// ReSharper restore UnusedMember.Global
|
||||
}
|
||||
|
||||
public enum ETextureQuality
|
||||
{
|
||||
// ReSharper disable InconsistentNaming
|
||||
@@ -282,6 +272,16 @@ namespace VocaluxeLib.Menu
|
||||
// ReSharper restore InconsistentNaming
|
||||
}
|
||||
|
||||
public enum ELyricsPosition
|
||||
{
|
||||
// ReSharper disable InconsistentNaming
|
||||
TR_CONFIG_LYRICSPOSITION_BOTTOM,
|
||||
TR_CONFIG_LYRICSPOSITION_TOP,
|
||||
TR_CONFIG_LYRICSPOSITION_BOTH,
|
||||
TR_CONFIG_LYRICSPOSITION_DYNAMIC
|
||||
// ReSharper restore InconsistentNaming
|
||||
}
|
||||
|
||||
public enum ELyricStyle
|
||||
{
|
||||
Fill,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
using VocaluxeLib.PartyModes;
|
||||
@@ -240,9 +241,10 @@ namespace VocaluxeLib.Menu
|
||||
public interface ISongs
|
||||
{
|
||||
int GetNumSongs();
|
||||
int GetNumVisibleSongs();
|
||||
int GetNumSongsVisible();
|
||||
int GetNumCategories();
|
||||
int NumSongsInCategory(int categoryIndex);
|
||||
bool IsInCategory();
|
||||
|
||||
int GetCurrentCategoryIndex();
|
||||
EOffOn GetTabs();
|
||||
@@ -253,13 +255,11 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
CSong GetVisibleSong(int visibleIndex);
|
||||
CSong GetSongByID(int songID);
|
||||
CSong[] GetSongs();
|
||||
CSong[] GetSongsNotSung();
|
||||
ReadOnlyCollection<CSong> GetVisibleSongs();
|
||||
CCategory GetCategory(int index);
|
||||
|
||||
void AddPartySongSung(int songID);
|
||||
void ResetPartySongSung();
|
||||
void ResetPartySongSung(int catIndex);
|
||||
void ResetSongSung(int catIndex = -1);
|
||||
|
||||
void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions);
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace VocaluxeLib.Menu
|
||||
bool GetCover(string fileName, ref STexture texture, int coverSize);
|
||||
}
|
||||
|
||||
public interface IInputs
|
||||
public interface IControllers
|
||||
{
|
||||
void SetRumble(float duration);
|
||||
}
|
||||
|
||||
@@ -348,13 +348,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
public string Lyrics
|
||||
{
|
||||
get
|
||||
{
|
||||
string lyrics = String.Empty;
|
||||
foreach (CNote note in _Notes)
|
||||
lyrics += note.Text;
|
||||
return lyrics;
|
||||
}
|
||||
get { return _Notes.Aggregate(String.Empty, (current, note) => current + note.Text); }
|
||||
}
|
||||
|
||||
public int NoteCount
|
||||
@@ -364,13 +358,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
public int Points
|
||||
{
|
||||
get
|
||||
{
|
||||
int points = 0;
|
||||
foreach (CNote note in _Notes)
|
||||
points += note.Points;
|
||||
return points;
|
||||
}
|
||||
get { return _Notes.Sum(note => note.Points); }
|
||||
}
|
||||
|
||||
public CNote[] Notes
|
||||
@@ -423,6 +411,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
return _PerfectLine;
|
||||
}
|
||||
|
||||
//Find last note with StartBeat<=Beat
|
||||
public int FindPreviousNote(int beat)
|
||||
{
|
||||
//If no notes -> No previous note
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#region license
|
||||
// /*
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
public class CCategory
|
||||
{
|
||||
public readonly string Name;
|
||||
private STexture _CoverTextureSmall = new STexture(-1);
|
||||
private STexture _CoverTextureBig = new STexture(-1);
|
||||
private bool _CoverBigLoaded;
|
||||
public readonly List<CSongPointer> Songs = new List<CSongPointer>();
|
||||
|
||||
public CCategory(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public STexture CoverTextureSmall
|
||||
{
|
||||
get { return _CoverTextureSmall; }
|
||||
|
||||
set { _CoverTextureSmall = value; }
|
||||
}
|
||||
|
||||
public STexture CoverTextureBig
|
||||
{
|
||||
get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; }
|
||||
set
|
||||
{
|
||||
if (value.Index == -1)
|
||||
return;
|
||||
_CoverTextureBig = value;
|
||||
_CoverBigLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
public CCategory(string name, STexture coverSmall, STexture coverBig)
|
||||
{
|
||||
Name = name;
|
||||
CoverTextureSmall = coverSmall;
|
||||
CoverTextureBig = coverBig;
|
||||
}
|
||||
|
||||
public CCategory(CCategory cat)
|
||||
{
|
||||
Name = cat.Name;
|
||||
CoverTextureSmall = cat.CoverTextureSmall;
|
||||
CoverTextureBig = cat.CoverTextureBig;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,19 @@ using VocaluxeLib.Menu.SingNotes;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
public class CSongPointer
|
||||
{
|
||||
public readonly int SongID;
|
||||
public string SortString;
|
||||
public bool IsSung;
|
||||
|
||||
public CSongPointer(int id, string sortString)
|
||||
{
|
||||
SongID = id;
|
||||
SortString = sortString;
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum EHeaderFlags
|
||||
{
|
||||
@@ -40,58 +53,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public enum EMedleySource
|
||||
{
|
||||
None,
|
||||
None = 0,
|
||||
Calculated,
|
||||
Tag
|
||||
}
|
||||
|
||||
public class CCategory
|
||||
{
|
||||
public readonly string Name;
|
||||
private STexture _CoverTextureSmall = new STexture(-1);
|
||||
private STexture _CoverTextureBig = new STexture(-1);
|
||||
private bool _CoverBigLoaded;
|
||||
|
||||
public CCategory(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public STexture CoverTextureSmall
|
||||
{
|
||||
get { return _CoverTextureSmall; }
|
||||
|
||||
set { _CoverTextureSmall = value; }
|
||||
}
|
||||
|
||||
public STexture CoverTextureBig
|
||||
{
|
||||
get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; }
|
||||
set
|
||||
{
|
||||
if (value.Index != -1)
|
||||
{
|
||||
_CoverTextureBig = value;
|
||||
_CoverBigLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CCategory(string name, STexture coverSmall, STexture coverBig)
|
||||
{
|
||||
Name = name;
|
||||
CoverTextureSmall = coverSmall;
|
||||
CoverTextureBig = coverBig;
|
||||
}
|
||||
|
||||
public CCategory(CCategory cat)
|
||||
{
|
||||
Name = cat.Name;
|
||||
CoverTextureSmall = cat.CoverTextureSmall;
|
||||
CoverTextureBig = cat.CoverTextureBig;
|
||||
}
|
||||
}
|
||||
|
||||
public struct SMedley
|
||||
{
|
||||
public EMedleySource Source;
|
||||
@@ -99,28 +65,16 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public int EndBeat;
|
||||
public float FadeInTime;
|
||||
public float FadeOutTime;
|
||||
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
public SMedley(int dummy)
|
||||
// ReSharper restore UnusedParameter.Local
|
||||
{
|
||||
Source = EMedleySource.None;
|
||||
StartBeat = 0;
|
||||
EndBeat = 0;
|
||||
FadeInTime = 0f;
|
||||
FadeOutTime = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public class CSong
|
||||
{
|
||||
private bool _CoverSmallLoaded;
|
||||
private bool _CoverBigLoaded;
|
||||
private bool _NotesLoaded;
|
||||
private STexture _CoverTextureSmall = new STexture(-1);
|
||||
private STexture _CoverTextureBig = new STexture(-1);
|
||||
|
||||
public SMedley Medley = new SMedley(0);
|
||||
public SMedley Medley;
|
||||
|
||||
public bool CalculateMedley = true;
|
||||
public float PreviewStart;
|
||||
@@ -140,18 +94,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public EAspect VideoAspect = EAspect.Crop;
|
||||
|
||||
public bool CoverSmallLoaded
|
||||
{
|
||||
get { return _CoverSmallLoaded; }
|
||||
}
|
||||
public bool CoverBigLoaded
|
||||
{
|
||||
get { return _CoverBigLoaded; }
|
||||
}
|
||||
public bool NotesLoaded
|
||||
{
|
||||
get { return _NotesLoaded; }
|
||||
}
|
||||
public bool NotesLoaded { get; private set; }
|
||||
|
||||
public STexture CoverTextureSmall
|
||||
{
|
||||
@@ -171,12 +114,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public STexture CoverTextureBig
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_CoverBigLoaded)
|
||||
return _CoverTextureBig;
|
||||
return _CoverTextureSmall;
|
||||
}
|
||||
get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; }
|
||||
set
|
||||
{
|
||||
_CoverTextureBig = value;
|
||||
@@ -278,7 +216,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
VideoAspect = song.VideoAspect;
|
||||
_CoverSmallLoaded = song._CoverSmallLoaded;
|
||||
_CoverBigLoaded = song._CoverBigLoaded;
|
||||
_NotesLoaded = song._NotesLoaded;
|
||||
NotesLoaded = song.NotesLoaded;
|
||||
|
||||
Artist = song.Artist;
|
||||
Title = song.Title;
|
||||
@@ -619,7 +557,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private bool _ReadNotes(string filePath, bool forceReload = false)
|
||||
{
|
||||
//Skip loading if already done and no reload is forced
|
||||
if (_NotesLoaded && !forceReload)
|
||||
if (NotesLoaded && !forceReload)
|
||||
return true;
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
@@ -784,7 +722,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
_FindRefrain();
|
||||
_FindShortEnd();
|
||||
_NotesLoaded = true;
|
||||
NotesLoaded = true;
|
||||
if (IsDuet)
|
||||
_CheckDuet();
|
||||
}
|
||||
|
||||
@@ -35,12 +35,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_CreateSongMenu();
|
||||
}
|
||||
|
||||
public void UpdateSongMenuType()
|
||||
{
|
||||
if (_Type != CBase.Config.GetSongMenuType())
|
||||
_CreateSongMenu();
|
||||
}
|
||||
|
||||
public bool Selected
|
||||
{
|
||||
get { return _SongMenu.IsSelected(); }
|
||||
|
||||
@@ -252,8 +252,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
StaticMedleyTagIcon = new CStatic(_PartyModeID)
|
||||
}
|
||||
};
|
||||
|
||||
_ThemeLoaded = false;
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
@@ -561,7 +559,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (!_Initialized)
|
||||
return false;
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() >= 0 || _PreviewSelected < 0 || _PreviewSelected >= CBase.Songs.GetNumCategories())
|
||||
if (CBase.Songs.IsInCategory() || _PreviewSelected < 0 || _PreviewSelected >= CBase.Songs.GetNumCategories())
|
||||
return false;
|
||||
_EnterCategory(_PreviewSelected);
|
||||
return true;
|
||||
@@ -584,7 +582,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() == -1)
|
||||
if (!CBase.Songs.IsInCategory())
|
||||
return;
|
||||
|
||||
_Reset();
|
||||
@@ -598,7 +596,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
protected void _SelectSong(int nr)
|
||||
{
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && (CBase.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_Actsong != nr) || (_Streams.Count == 0)))
|
||||
if (CBase.Songs.IsInCategory() && (CBase.Songs.GetNumSongsVisible() > 0) && (nr >= 0) && ((_Actsong != nr) || (_Streams.Count == 0)))
|
||||
{
|
||||
_Streams.ForEach(soundStream => CBase.Sound.FadeAndStop(soundStream, 0f, 1f));
|
||||
_Streams.Clear();
|
||||
@@ -609,7 +607,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
CBase.Drawing.RemoveTexture(ref _Vidtex);
|
||||
|
||||
_Actsong = nr;
|
||||
if (_Actsong >= CBase.Songs.GetNumVisibleSongs())
|
||||
if (_Actsong >= CBase.Songs.GetNumSongsVisible())
|
||||
_Actsong = 0;
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetCurrentCategoryIndex() == -1)
|
||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && !CBase.Songs.IsInCategory())
|
||||
_EnterCategory(0);
|
||||
_ActualSelection = -1;
|
||||
_Locked = -1;
|
||||
@@ -138,7 +138,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
//AfterCategoryChange();
|
||||
SetSelectedSong(_ActSong);
|
||||
_AfterCategoryChange();
|
||||
CBase.Songs.UpdateRandomSongList();
|
||||
|
||||
int actcat = _PreviewSelected;
|
||||
if ((CBase.Songs.GetNumCategories() > 0) && (actcat < 0))
|
||||
@@ -155,7 +154,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
|
||||
if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter() != "")
|
||||
if (CBase.Songs.GetNumSongsVisible() == 0 && CBase.Songs.GetSearchFilter() != "")
|
||||
{
|
||||
_CoverBig.Texture = _CoverBigTexture;
|
||||
_Artist.Text = String.Empty;
|
||||
@@ -202,7 +201,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
switch (keyEvent.Key)
|
||||
{
|
||||
case Keys.Enter:
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() < 0)
|
||||
if (!CBase.Songs.IsInCategory())
|
||||
{
|
||||
_EnterCategory(_PreviewSelected);
|
||||
keyEvent.Handled = true;
|
||||
@@ -213,7 +212,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() > -1 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && songOptions.Selection.CategoryChangeAllowed)
|
||||
if (CBase.Songs.IsInCategory() && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && songOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
_ShowCategories();
|
||||
keyEvent.Handled = true;
|
||||
@@ -235,7 +234,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
if (_Locked > 0 && (!songOptions.Selection.RandomOnly || songOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0))
|
||||
if (_Locked > 0 && (!songOptions.Selection.RandomOnly || songOptions.Selection.CategoryChangeAllowed && !CBase.Songs.IsInCategory()))
|
||||
{
|
||||
_Locked--;
|
||||
_UpdateList();
|
||||
@@ -243,7 +242,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
break;
|
||||
|
||||
case Keys.Right:
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() < 0 && songOptions.Selection.CategoryChangeAllowed)
|
||||
if (!CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
if (_Locked < CBase.Songs.GetNumCategories() - 1)
|
||||
{
|
||||
@@ -253,7 +252,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() != -1 && _Locked < CBase.Songs.GetNumVisibleSongs() - 1 && !songOptions.Selection.RandomOnly)
|
||||
if (CBase.Songs.IsInCategory() && _Locked < CBase.Songs.GetNumSongsVisible() - 1 && !songOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked++;
|
||||
_UpdateList();
|
||||
@@ -269,7 +268,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
|
||||
if (_Locked > _NumW - 1 &&
|
||||
(!songOptions.Selection.RandomOnly || songOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0))
|
||||
(!songOptions.Selection.RandomOnly || songOptions.Selection.CategoryChangeAllowed && !CBase.Songs.IsInCategory()))
|
||||
{
|
||||
_Locked -= _NumW;
|
||||
_UpdateList();
|
||||
@@ -283,7 +282,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
break;
|
||||
}
|
||||
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() < 0 && songOptions.Selection.CategoryChangeAllowed)
|
||||
if (!CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
if (_Locked < CBase.Songs.GetNumCategories() - _NumW)
|
||||
{
|
||||
@@ -291,7 +290,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_UpdateList();
|
||||
}
|
||||
}
|
||||
else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !songOptions.Selection.RandomOnly)
|
||||
else if (_Locked < CBase.Songs.GetNumSongsVisible() - _NumW && !songOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked += _NumW;
|
||||
_UpdateList();
|
||||
@@ -319,13 +318,13 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
bool sel = false;
|
||||
int lastselection = _ActualSelection;
|
||||
|
||||
if (!songOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && songOptions.Selection.CategoryChangeAllowed)
|
||||
if (!songOptions.Selection.RandomOnly || !CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if ((tile.Texture.Index != _CoverTexture.Index) && CHelper.IsInBounds(tile.Rect, mouseEvent) && !sel)
|
||||
{
|
||||
if (mouseEvent.LB || CBase.Songs.GetCurrentCategoryIndex() == -1)
|
||||
if (mouseEvent.LB || !CBase.Songs.IsInCategory())
|
||||
{
|
||||
if (_PreviewSelected == i + _Offset)
|
||||
_Locked = _PreviewSelected;
|
||||
@@ -348,12 +347,12 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
sel = true;
|
||||
|
||||
if (mouseEvent.Sender == ESender.WiiMote && _ActualSelection != lastselection && _ActualSelection != -1)
|
||||
CBase.Input.SetRumble(0.050f);
|
||||
CBase.Controller.SetRumble(0.050f);
|
||||
|
||||
if (!sel)
|
||||
_ActualSelection = -1;
|
||||
|
||||
if (mouseEvent.RB && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON &&
|
||||
if (mouseEvent.RB && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.IsInCategory() && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON &&
|
||||
songOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
_ShowCategories();
|
||||
@@ -367,7 +366,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (CHelper.IsInBounds(_CoverBig.Rect, mouseEvent) || CHelper.IsInBounds(_TextBG.Rect, mouseEvent))
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
else if (mouseEvent.LB && (CBase.Songs.GetCurrentCategoryIndex() == -1))
|
||||
else if (mouseEvent.LB && (!CBase.Songs.IsInCategory()))
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
@@ -381,7 +380,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
|
||||
if (mouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, mouseEvent) &&
|
||||
(!songOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && songOptions.Selection.CategoryChangeAllowed))
|
||||
(!songOptions.Selection.RandomOnly || !CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed))
|
||||
_UpdateList(_Offset + _NumW * mouseEvent.Wheel);
|
||||
}
|
||||
|
||||
@@ -390,20 +389,22 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected && _Active)
|
||||
tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop, false);
|
||||
tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop);
|
||||
else
|
||||
{
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (tile.Texture.Index != _CoverTexture.Index)
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Crop, false);
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Crop);
|
||||
else
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Stretch, false);
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Stretch);
|
||||
}
|
||||
}
|
||||
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() >= 0)
|
||||
if (CBase.Songs.IsInCategory())
|
||||
{
|
||||
int actsong = _PreviewSelected;
|
||||
if ((CBase.Songs.GetNumVisibleSongs() > actsong) && (actsong >= 0))
|
||||
if ((CBase.Songs.GetNumSongsVisible() > actsong) && (actsong >= 0))
|
||||
{
|
||||
CSong song = CBase.Songs.GetVisibleSong(actsong);
|
||||
|
||||
@@ -434,7 +435,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Artist.Text = CBase.Songs.GetCategory(actcat).Name;
|
||||
|
||||
int num = CBase.Songs.NumSongsInCategory(actcat);
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (num != 1)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString());
|
||||
else
|
||||
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString());
|
||||
@@ -491,7 +494,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
return new CStatic(_PartyModeID);
|
||||
}
|
||||
|
||||
protected void _SetSelectedTile(int itemNr)
|
||||
private void _SetSelectedTile(int itemNr)
|
||||
{
|
||||
bool sel = _Tiles.Any(tile => tile.Selected);
|
||||
|
||||
@@ -529,7 +532,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
base.SetSelectedSong(visibleSongNr);
|
||||
|
||||
if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumVisibleSongs())
|
||||
if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumSongsVisible())
|
||||
_SetSelectedTile(visibleSongNr);
|
||||
}
|
||||
|
||||
@@ -592,11 +595,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (_ActualSelection >= 0 && _ActualSelection < _Tiles.Count)
|
||||
_Tiles[_ActualSelection].Selected = true;
|
||||
|
||||
if ((_LastKnownNumSongs == CBase.Songs.GetNumVisibleSongs()) && (_LastKnownCategory == CBase.Songs.GetCurrentCategoryIndex()))
|
||||
if ((_LastKnownNumSongs == CBase.Songs.GetNumSongsVisible()) && (_LastKnownCategory == CBase.Songs.GetCurrentCategoryIndex()))
|
||||
return;
|
||||
|
||||
_LastKnownCategory = CBase.Songs.GetCurrentCategoryIndex();
|
||||
_LastKnownNumSongs = CBase.Songs.GetNumVisibleSongs();
|
||||
_LastKnownNumSongs = CBase.Songs.GetNumSongsVisible();
|
||||
_UpdateList(0, true);
|
||||
CBase.Songs.UpdateRandomSongList();
|
||||
}
|
||||
@@ -608,8 +611,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
private void _UpdateList(int offset, bool force = false)
|
||||
{
|
||||
bool isInCategory = CBase.Songs.GetCurrentCategoryIndex() >= 0;
|
||||
int itemCount = isInCategory ? CBase.Songs.GetNumVisibleSongs() : CBase.Songs.GetNumCategories();
|
||||
bool isInCategory = CBase.Songs.IsInCategory();
|
||||
int itemCount = isInCategory ? CBase.Songs.GetNumSongsVisible() : CBase.Songs.GetNumCategories();
|
||||
|
||||
if (offset >= (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1)))
|
||||
offset = (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1));
|
||||
@@ -624,10 +627,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (itemCount > i + offset)
|
||||
{
|
||||
if (isInCategory)
|
||||
_Tiles[i].Texture = CBase.Songs.GetVisibleSong(i + offset).CoverTextureSmall;
|
||||
else
|
||||
_Tiles[i].Texture = CBase.Songs.GetCategory(i + offset).CoverTextureSmall;
|
||||
_Tiles[i].Texture = isInCategory ? CBase.Songs.GetVisibleSong(i + offset).CoverTextureSmall : CBase.Songs.GetCategory(i + offset).CoverTextureSmall;
|
||||
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -29,7 +29,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
@@ -41,7 +41,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -52,7 +52,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
@@ -64,7 +64,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -74,7 +74,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
@@ -86,7 +86,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -96,7 +96,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
@@ -137,6 +137,7 @@
|
||||
<Compile Include="Menu\SingNotes\CNotes.cs" />
|
||||
<Compile Include="Menu\SingNotes\CSingNotes.cs" />
|
||||
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
|
||||
<Compile Include="Menu\SongMenu\CCategory.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSong.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenu.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenuBook.cs" />
|
||||
@@ -153,6 +154,9 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)Output\" /I /Y</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
Reference in new issue
Block a user