Merge remote-tracking branch 'upstream/release-0.1' into release-0.1

This commit is contained in:
Florian Kuepper committed 2012-03-25 15:18:23 +02:00
commit 5d38e6d711
29 files changed
+337 -96

No files matched your search

+2 -2
View File
@@ -107,8 +107,8 @@ Vocaluxe.exe -ConfigFile MyConfig.xml -ScoreFile C:\Vocaluxe\Highscores\MyHighsc
[TAB] to open the background music controls (not on all screens).
Songscreen
[R] to select a random song
[F3] or [CTRL]+[F] to open/close the song search menu
[CTRL] + [R] to select a random song
[F3] to open/close the song search menu
[A] to sing all songs from a category
+12 -12
View File
@@ -386,13 +386,13 @@
<ArrowRightH>40</ArrowRightH>
<!--<Color>: SelectSlide color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>SelectSlideColor</Color>
<Color>Player1Dim</Color>
<!--<SColor>: Selected SelectSlide color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>SelectSlideSColor</SColor>
<SColor>Player1Dim</SColor>
<!--<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)-->
<!--or <HR>, <HG>, <HB>, <HA> (lower priority)-->
<HColor>SelectSlideHColor</HColor>
<HColor>Player1</HColor>
<!--<ArrowColor>: Arrow color from ColorScheme (high priority)-->
<!--or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)-->
<ArrowColor>ArrowColor</ArrowColor>
@@ -404,7 +404,7 @@
<TextColor>TextColor</TextColor>
<!--<TextSColor>: Selected text color from ColorScheme (high priority)-->
<!--or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)-->
<TextSColor>TextSColor</TextSColor>
<TextSColor>Player1</TextSColor>
<!--<TextH>: Text height-->
<TextH>32,00</TextH>
<!--<TextMaxW>: Maximum text width (if exists)-->
@@ -451,13 +451,13 @@
<ArrowRightH>40</ArrowRightH>
<!--<Color>: SelectSlide color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>SelectSlideColor</Color>
<Color>Player2Dim</Color>
<!--<SColor>: Selected SelectSlide color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>SelectSlideSColor</SColor>
<SColor>Player2Dim</SColor>
<!--<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)-->
<!--or <HR>, <HG>, <HB>, <HA> (lower priority)-->
<HColor>SelectSlideHColor</HColor>
<HColor>Player2</HColor>
<!--<ArrowColor>: Arrow color from ColorScheme (high priority)-->
<!--or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)-->
<ArrowColor>ArrowColor</ArrowColor>
@@ -469,7 +469,7 @@
<TextColor>TextColor</TextColor>
<!--<TextSColor>: Selected text color from ColorScheme (high priority)-->
<!--or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)-->
<TextSColor>TextSColor</TextSColor>
<TextSColor>Player2</TextSColor>
<!--<TextH>: Text height-->
<TextH>32,00</TextH>
<!--<TextMaxW>: Maximum text width (if exists)-->
@@ -516,13 +516,13 @@
<ArrowRightH>40</ArrowRightH>
<!--<Color>: SelectSlide color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>SelectSlideColor</Color>
<Color>Player3Dim</Color>
<!--<SColor>: Selected SelectSlide color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>SelectSlideSColor</SColor>
<SColor>Player3Dim</SColor>
<!--<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)-->
<!--or <HR>, <HG>, <HB>, <HA> (lower priority)-->
<HColor>SelectSlideHColor</HColor>
<HColor>Player3</HColor>
<!--<ArrowColor>: Arrow color from ColorScheme (high priority)-->
<!--or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)-->
<ArrowColor>ArrowColor</ArrowColor>
@@ -534,7 +534,7 @@
<TextColor>TextColor</TextColor>
<!--<TextSColor>: Selected text color from ColorScheme (high priority)-->
<!--or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)-->
<TextSColor>TextSColor</TextSColor>
<TextSColor>Player3</TextSColor>
<!--<TextH>: Text height-->
<TextH>32,00</TextH>
<!--<TextMaxW>: Maximum text width (if exists)-->
+36
View File
@@ -46,6 +46,42 @@
</Player6>
</Colors>
<ColorSchemes>
<Player1Dim>
<R>0,000</R>
<G>0,000</G>
<B>1,000</B>
<A>0,500</A>
</Player1Dim>
<Player2Dim>
<R>1,000</R>
<G>0,000</G>
<B>0,000</B>
<A>0,500</A>
</Player2Dim>
<Player3Dim>
<R>0,000</R>
<G>1,000</G>
<B>0,000</B>
<A>0,500</A>
</Player3Dim>
<Player4Dim>
<R>0,500</R>
<G>0,000</G>
<B>1,000</B>
<A>0,500</A>
</Player4Dim>
<Player5Dim>
<R>0,000</R>
<G>0,500</G>
<B>1,000</B>
<A>0,500</A>
</Player5Dim>
<Player6Dim>
<R>1,000</R>
<G>0,000</G>
<B>0,500</B>
<A>0,500</A>
</Player6Dim>
<BackgroundColor>
<R>0,000</R>
<G>0,000</G>
+36
View File
@@ -46,6 +46,42 @@
</Player6>
</Colors>
<ColorSchemes>
<Player1Dim>
<R>0,000</R>
<G>0,000</G>
<B>1,000</B>
<A>0,500</A>
</Player1Dim>
<Player2Dim>
<R>1,000</R>
<G>0,000</G>
<B>0,000</B>
<A>0,500</A>
</Player2Dim>
<Player3Dim>
<R>0,000</R>
<G>1,000</G>
<B>0,000</B>
<A>0,500</A>
</Player3Dim>
<Player4Dim>
<R>0,500</R>
<G>0,000</G>
<B>1,000</B>
<A>0,500</A>
</Player4Dim>
<Player5Dim>
<R>0,000</R>
<G>0,500</G>
<B>1,000</B>
<A>0,500</A>
</Player5Dim>
<Player6Dim>
<R>1,000</R>
<G>0,000</G>
<B>0,500</B>
<A>0,500</A>
</Player6Dim>
<BackgroundColor>
<R>0,000</R>
<G>0,000</G>
+36
View File
@@ -46,6 +46,42 @@
</Player6>
</Colors>
<ColorSchemes>
<Player1Dim>
<R>0,000</R>
<G>0,000</G>
<B>1,000</B>
<A>0,500</A>
</Player1Dim>
<Player2Dim>
<R>1,000</R>
<G>0,000</G>
<B>0,000</B>
<A>0,500</A>
</Player2Dim>
<Player3Dim>
<R>0,000</R>
<G>1,000</G>
<B>0,000</B>
<A>0,500</A>
</Player3Dim>
<Player4Dim>
<R>0,500</R>
<G>0,000</G>
<B>1,000</B>
<A>0,500</A>
</Player4Dim>
<Player5Dim>
<R>0,000</R>
<G>0,500</G>
<B>1,000</B>
<A>0,500</A>
</Player5Dim>
<Player6Dim>
<R>1,000</R>
<G>0,000</G>
<B>0,500</B>
<A>0,500</A>
</Player6Dim>
<BackgroundColor>
<R>0,000</R>
<G>0,000</G>
+36
View File
@@ -46,6 +46,42 @@
</Player6>
</Colors>
<ColorSchemes>
<Player1Dim>
<R>0,000</R>
<G>0,000</G>
<B>1,000</B>
<A>0,500</A>
</Player1Dim>
<Player2Dim>
<R>1,000</R>
<G>0,000</G>
<B>0,000</B>
<A>0,500</A>
</Player2Dim>
<Player3Dim>
<R>0,000</R>
<G>1,000</G>
<B>0,000</B>
<A>0,500</A>
</Player3Dim>
<Player4Dim>
<R>0,500</R>
<G>0,000</G>
<B>1,000</B>
<A>0,500</A>
</Player4Dim>
<Player5Dim>
<R>0,000</R>
<G>0,500</G>
<B>1,000</B>
<A>0,500</A>
</Player5Dim>
<Player6Dim>
<R>1,000</R>
<G>0,000</G>
<B>0,500</B>
<A>0,500</A>
</Player6Dim>
<BackgroundColor>
<R>0,000</R>
<G>0,000</G>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10 -1
View File
@@ -277,6 +277,12 @@ namespace Vocaluxe.Base
#region Graphics
CHelper.TryGetEnumValueFromXML<ERenderer>("//root/Graphics/Renderer", navigator, ref Renderer);
CHelper.TryGetEnumValueFromXML<ETextureQuality>("//root/Graphics/TextureQuality", navigator, ref TextureQuality);
CHelper.TryGetIntValueFromXML("//root/Graphics/CoverSize", navigator, ref CoverSize);
if (CoverSize > 1024)
CoverSize = 1024;
if (CoverSize < 32)
CoverSize = 32;
CHelper.TryGetIntValueFromXML("//root/Graphics/ScreenW", navigator, ref ScreenW);
CHelper.TryGetIntValueFromXML("//root/Graphics/ScreenH", navigator, ref ScreenH);
CHelper.TryGetEnumValueFromXML<EAntiAliasingModes>("//root/Graphics/AAMode", navigator, ref AAMode);
@@ -440,7 +446,10 @@ namespace Vocaluxe.Base
writer.WriteComment("TextureQuality: " + ListStrings(Enum.GetNames(typeof(ETextureQuality))));
writer.WriteElementString("TextureQuality", Enum.GetName(typeof(ETextureQuality), TextureQuality));
writer.WriteComment("CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)");
writer.WriteElementString("CoverSize", CoverSize.ToString());
writer.WriteComment("Screen width and height (pixels)");
writer.WriteElementString("ScreenW", ScreenW.ToString());
writer.WriteElementString("ScreenH", ScreenH.ToString());
+3 -3
View File
@@ -238,13 +238,13 @@ namespace Vocaluxe.Base
{
_Cover.Clear();
List<string> cover = CHelper.GetValuesFromXML("Cover", navigator);
for (int i = 1; i <= cover.Count; i++)
for (int i = 0; i < cover.Count; i++)
{
SCover sk = new SCover();
string name = String.Empty;
string value = String.Empty;
CHelper.GetValueFromXML("//root/Cover/Cover" + i + "/Name", navigator, ref name, String.Empty);
CHelper.GetValueFromXML("//root/Cover/Cover" + i + "/Path", navigator, ref value, String.Empty);
CHelper.GetValueFromXML("//root/Cover/" + cover[i] + "/Name", navigator, ref name, String.Empty);
CHelper.GetValueFromXML("//root/Cover/" + cover[i] + "/Path", navigator, ref value, String.Empty);
sk.Name = name;
sk.Value = Path.Combine(coverTheme.Folder,value);
if (File.Exists(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value))))
+30 -2
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
@@ -21,11 +22,38 @@ namespace Vocaluxe.Base
case ERenderer.TR_CONFIG_SOFTWARE:
_Draw = new CDrawWinForm();
break;
case ERenderer.TR_CONFIG_OPENGL:
_Draw = new COpenGL();
try
{
_Draw = new COpenGL();
}
catch (Exception e)
{
MessageBox.Show(e.Message + " - Error in initializing of OpenGL. Please check whether" +
" your graphic card drivers are up to date.");
CLog.LogError(e.Message + " - Error in initializing of OpenGL. Please check whether" +
" your graphic card drivers are up to date.");
Environment.Exit(Environment.ExitCode);
}
break;
case ERenderer.TR_CONFIG_DIRECT3D:
_Draw = new CDirect3D();
try
{
_Draw = new CDirect3D();
}
catch (Exception e)
{
MessageBox.Show(e.Message + " - Error in initializing of Direct3D. Please check if " +
"your DirectX redistributables and graphic card drivers are up to date. You can " +
"download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
CLog.LogError(e.Message + " - Error in initializing of Direct3D. Please check if " +
"your DirectX redistributables and graphic card drivers are up to date. You can " +
"download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
Environment.Exit(Environment.ExitCode);
}
break;
default:
+3 -3
View File
@@ -56,7 +56,7 @@ namespace Vocaluxe.Base
private static int _NumErrors;
private static Stopwatch[] _BenchmarkTimer;
private static long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency;
private static double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
public static void Init()
{
@@ -129,8 +129,8 @@ namespace Vocaluxe.Base
}
float ms;
if (Stopwatch.IsHighResolution)
ms = (float)(((double)nanosecPerTick * (double)_BenchmarkTimer[BenchmarkNr].ElapsedTicks) / (1000.0 * 1000.0));
if (Stopwatch.IsHighResolution && nanosecPerTick != 0.0)
ms = (float)((nanosecPerTick * _BenchmarkTimer[BenchmarkNr].ElapsedTicks) / (1000.0 * 1000.0));
else
ms = (float)_BenchmarkTimer[BenchmarkNr].ElapsedMilliseconds;
+2 -2
View File
@@ -237,7 +237,7 @@ namespace Vocaluxe.Base
public static bool IsGuestProfile(int ProfileNr)
{
if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
return false;
return true; // this will prevent from saving dummy profiles to highscore db
return _Profiles[ProfileNr].GuestProfile == EOffOn.TR_CONFIG_ON;
}
@@ -246,7 +246,7 @@ namespace Vocaluxe.Base
{
if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
return false;
return _Profiles[ProfileNr].GuestProfile == EOffOn.TR_CONFIG_ON;
return _Profiles[ProfileNr].Active == EOffOn.TR_CONFIG_ON;
}
public static void SetAvatar(int ProfileNr, int AvatarNr)
+2 -2
View File
@@ -45,9 +45,9 @@ namespace Vocaluxe.Base
public const int iVersionMajor = 0;
public const int iVersionMinor = 1; // milestones
public const int iVersionSub = 0; // steps
public const ERevision VersionRevision = ERevision.Beta;
public const ERevision VersionRevision = ERevision.RC;
public const int iBuild = 56; // Increase on every published version! Never Reset!
public const int iBuild = 59; // Increase on every published version! Never Reset!
public const int iDatabaseHighscoreVersion = 1;
public const int iDatabaseCoverVersion = 1;
+3 -3
View File
@@ -497,7 +497,7 @@ namespace Vocaluxe.Base
{
get
{
long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency;
double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
long ticks = _Timer.ElapsedTicks;
float dt = _Timer.ElapsedMilliseconds / 1000f;
@@ -577,7 +577,7 @@ namespace Vocaluxe.Base
{
get
{
long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency;
double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
long ticks = _STimer.ElapsedTicks;
float dt = _STimer.ElapsedMilliseconds / 1000f;
@@ -613,7 +613,7 @@ namespace Vocaluxe.Base
{
_STimer.Stop();
long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency;
double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
long ticks = _STimer.ElapsedTicks;
float dt = _STimer.ElapsedMilliseconds / 1000f;
+2 -2
View File
@@ -119,7 +119,7 @@ namespace Vocaluxe.Base
{
private static Stopwatch _Stopwatch = new Stopwatch();
private static float _fps = 0.0f;
private static long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency;
private static double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
public static void Reset()
{
@@ -149,7 +149,7 @@ namespace Vocaluxe.Base
{
long ticks = _Stopwatch.ElapsedTicks;
if (Stopwatch.IsHighResolution && ticks != 0)
return (float)(((double)nanosecPerTick * (double)ticks) / (1000.0 * 1000.0));
return (float)((nanosecPerTick * ticks) / (1000.0 * 1000.0));
else
return (float)_Stopwatch.ElapsedMilliseconds;
}
+100 -41
View File
@@ -71,7 +71,18 @@ namespace Vocaluxe.Lib.Draw
_VerticesRotationMatrices = new Queue<Matrix>();
_Keys = new CKeys();
_D3D = new Direct3D();
try
{
_D3D = new Direct3D();
}
catch (Direct3D9NotFoundException e)
{
MessageBox.Show("No DirectX runtimes were found, please download and install them " +
"from http://www.microsoft.com/download/en/details.aspx?id=8109",
CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
CLog.LogError(e.Message + " - No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109");
Environment.Exit(Environment.ExitCode);
}
this.Paint += new PaintEventHandler(this.OnPaintEvent);
this.Closing += new CancelEventHandler(this.OnClosingEvent);
@@ -165,19 +176,31 @@ namespace Vocaluxe.Lib.Draw
flags = CreateFlags.HardwareVertexProcessing;
else
flags = CreateFlags.SoftwareVertexProcessing;
_Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters);
try
{
_Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters);
}
catch (Exception e)
{
MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " +
"and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
CLog.LogError(e.Message + " - Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
Environment.Exit(Environment.ExitCode);
}
finally
{
if (_Device == null || _Device.Disposed)
{
MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " +
"and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
CLog.LogError("Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
Environment.Exit(Environment.ExitCode);
}
}
this.CenterToScreen();
//This creates a new white texture and adds it to the texture pool
//This texture is used for the DrawRect method
Bitmap blankMap = new Bitmap(1, 1);
Graphics g = Graphics.FromImage(blankMap);
g.Clear(Color.White);
g.Dispose();
blankTexture = AddTexture(blankMap);
blankMap.Dispose();
}
#region form events
@@ -204,7 +227,6 @@ namespace Vocaluxe.Lib.Draw
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
this.ClientSize = this.ClientSize;
RResize();
}
@@ -399,27 +421,47 @@ namespace Vocaluxe.Lib.Draw
Matrix translate = Matrix.Translation(new Vector3(-CSettings.iRenderW / 2, CSettings.iRenderH / 2, 0));
Matrix projection = Matrix.OrthoOffCenterLH(-CSettings.iRenderW / 2, CSettings.iRenderW / 2, -CSettings.iRenderH / 2, CSettings.iRenderH / 2, CSettings.zNear, CSettings.zFar);
_VertexBuffer = new VertexBuffer(_Device, CSettings.iVertexBufferElements * (4 * Marshal.SizeOf(typeof(TexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic, VertexFormat.Position | VertexFormat.Texture1 | VertexFormat.Diffuse, Pool.Default);
_Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(TexturedColoredVertex)));
_Device.VertexDeclaration = TexturedColoredVertex.GetDeclaration(_Device);
_Device.SetTransform(TransformState.Projection, projection);
_Device.SetTransform(TransformState.World, translate);
_Device.SetRenderState(RenderState.CullMode, Cull.None);
_Device.SetRenderState(RenderState.AlphaBlendEnable, true);
_Device.SetRenderState(RenderState.Lighting, false);
_Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
_Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
if (_PresentParameters.Multisample != MultisampleType.None)
_Device.SetRenderState(RenderState.MultisampleAntialias, true);
_Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear);
_Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
_Device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear);
_Device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp);
_Device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp);
_Device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture);
_Device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse);
_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate);
int[] indices = new int[6];
if (_Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(TexturedColoredVertex))).IsFailure)
CLog.LogError("Failed to set stream source");
_Device.VertexDeclaration = TexturedColoredVertex.GetDeclaration(_Device);
if(_Device.SetTransform(TransformState.Projection, projection).IsFailure)
CLog.LogError("Failed to set orthogonal matrix");
if(_Device.SetTransform(TransformState.World, translate).IsFailure)
CLog.LogError("Failed to set translation matrix");
if(_Device.SetRenderState(RenderState.CullMode, Cull.None).IsFailure)
CLog.LogError("Failed to set cull mode");
if(_Device.SetRenderState(RenderState.AlphaBlendEnable, true).IsFailure)
CLog.LogError("Failed to enable alpha blending");
if(_Device.SetRenderState(RenderState.Lighting, false).IsFailure)
CLog.LogError("Failed to disable lighting");
if(_Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha).IsFailure)
CLog.LogError("Failed to set destination blend");
if(_Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha).IsFailure)
CLog.LogError("Failed to set source blend");
if (_PresentParameters.Multisample != MultisampleType.None)
{
if(_Device.SetRenderState(RenderState.MultisampleAntialias, true).IsFailure)
CLog.LogError("Failed to set antialiasing");
}
if(_Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear).IsFailure)
CLog.LogError("Failed to set min filter");
if(_Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear).IsFailure)
CLog.LogError("Failed to set mag filter");
if(_Device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear).IsFailure)
CLog.LogError("Failed to set mip filter");
if(_Device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp).IsFailure)
CLog.LogError("Failed to set clamping on u");
if(_Device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp).IsFailure)
CLog.LogError("Failed to set claming on v");
if(_Device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture).IsFailure)
CLog.LogError("Failed to set alpha argument 1");
if(_Device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse).IsFailure)
CLog.LogError("Failed to set alpha argument 2");
if(_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate).IsFailure)
CLog.LogError("Failed to set alpha operation");
Int16[] indices = new Int16[6];
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
@@ -427,12 +469,22 @@ namespace Vocaluxe.Lib.Draw
indices[4] = 2;
indices[5] = 3;
_IndexBuffer = new IndexBuffer(_Device, 6 * sizeof(int), Usage.WriteOnly, Pool.Managed, false);
_IndexBuffer = new IndexBuffer(_Device, 6 * sizeof(Int16), Usage.WriteOnly, Pool.Managed, true);
DataStream stream = _IndexBuffer.Lock(0, 0, LockFlags.None);
stream.WriteRange(indices);
_IndexBuffer.Unlock();
_Device.Indices = _IndexBuffer;
//This creates a new white texture and adds it to the texture pool
//This texture is used for the DrawRect method
Bitmap blankMap = new Bitmap(1, 1);
Graphics g = Graphics.FromImage(blankMap);
g.Clear(Color.White);
g.Dispose();
blankTexture = AddTexture(blankMap);
blankMap.Dispose();
return true;
}
else
@@ -462,12 +514,14 @@ namespace Vocaluxe.Lib.Draw
//Clear the previous Frame
ClearScreen();
//We want to begin drawing
_Device.BeginScene();
if (_Device.BeginScene().IsFailure)
CLog.LogError("Failed to begin scene");
CheckQueque();
_Run = _Run && CGraphics.Draw();
RenderVertexBuffer();
//We finished drawing the frame
_Device.EndScene();
if (_Device.EndScene().IsFailure)
CLog.LogError("Failed to end scene");
_Run = CGraphics.UpdateGameLogic(_Keys, _Mouse);
try
{
@@ -517,7 +571,8 @@ namespace Vocaluxe.Lib.Draw
TexturedColoredVertex.GetDeclaration(_Device).Dispose();
_VertexBuffer.Dispose();
_IndexBuffer.Dispose();
_Device.Reset(_PresentParameters);
if (_Device.Reset(_PresentParameters).IsFailure)
CLog.LogError("Failed to reset the device");
}
/// <summary>
@@ -617,11 +672,14 @@ namespace Vocaluxe.Lib.Draw
for (int i = 0; i < _Vertices.Count; i += 4)
{
//Apply rotation
_Device.SetTransform(TransformState.World, _VerticesRotationMatrices.Dequeue());
if (_Device.SetTransform(TransformState.World, _VerticesRotationMatrices.Dequeue()).IsFailure)
CLog.LogError("Failed to set world transformation");
//Apply texture
_Device.SetTexture(0, _VerticesTextures.Dequeue());
if (_Device.SetTexture(0, _VerticesTextures.Dequeue()).IsFailure)
CLog.LogError("Failed to set texture");
//Draw 2 triangles from vertexbuffer
_Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, i, 0, 4, 0, 2);
if (_Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, i, 0, 4, 0, 2).IsFailure)
CLog.LogError("Failed to draw quad");
}
//Clear the queues for the next frame
_Vertices.Clear();
@@ -638,7 +696,8 @@ namespace Vocaluxe.Lib.Draw
/// </summary>
public void ClearScreen()
{
_Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
if (_Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0).IsFailure)
CLog.LogError("Failed to clear the backbuffer");
}
/// <summary>
+3 -6
View File
@@ -394,14 +394,12 @@ namespace Vocaluxe.Lib.Video
#region Threading
private void DoSkip()
{
string extension = Path.GetExtension(_FileName); //just a workaround for the mkv-search-bug in ffmpeg
{
_VideoSkipTime = _Gap;
_SkipTime = _Start + _Gap;
_BeforeLoop = false;
if (_SkipTime > 0 && extension != ".mkv")
if (_SkipTime > 0)
{
_VideoDecoderTime = _SkipTime;
try
@@ -419,8 +417,7 @@ namespace Vocaluxe.Lib.Video
_VideoDecoderTime = 0f;
try
{
if (extension != ".mkv")
CAcinerella.ac_seek(_videodecoder, -1, (Int64)0);
CAcinerella.ac_seek(_videodecoder, -1, (Int64)0);
}
catch (Exception e)
{
+13
View File
@@ -525,6 +525,19 @@ namespace Vocaluxe.Menu
_Textures[selection] = NewTexture;
}
public bool SetSelectionByValueIndex(int ValueIndex)
{
for (int i = 0; i < _ValueIndexes.Count; i++)
{
if (_ValueIndexes[i] == ValueIndex)
{
Selection = i;
return true;
}
}
return false;
}
public bool NextValue()
{
if (Selection < _ValueNames.Count - 1)
+1 -9
View File
@@ -223,15 +223,7 @@ namespace Vocaluxe.Screens
for (int p = 0; p < player.Length; p++)
{
bool guest = true;
if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles)
{
if (CProfiles.Profiles[player[p].ProfileID].GuestProfile == EOffOn.TR_CONFIG_OFF)
guest = false;
}
if (player[p].Points > CSettings.MinScoreForDB && player[p].SongFinished && !guest)
if (player[p].Points > CSettings.MinScoreForDB && player[p].SongFinished && !CProfiles.IsGuestProfile(player[p].ProfileID))
_NewEntryIDs.Add(CDataBase.AddScore(player[p]));
}
}
+7 -8
View File
@@ -63,7 +63,7 @@ namespace Vocaluxe.Screens
{
JumpTo(KeyEvent.Unicode);
return true;
}*/
} */
}
else
{
@@ -177,12 +177,12 @@ namespace Vocaluxe.Screens
Texts[htTexts(TextCategory)].Text = CSongs.GetActualCategoryName();
int song = SongMenus[htSongMenus(SongMenu)].GetActualSelection();
if ((CSongs.Category >= 0) && (song >= 0) && song < CSongs.VisibleSongs.Length)
if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Length)
{
Texts[htTexts(TextSelection)].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title;
CBackgroundMusic.Pause();
}
else if ((CSongs.Category == -1) && (song >= 0) && song < CSongs.Categories.Length)
else if (CSongs.Category == -1 && song >= 0 && song < CSongs.Categories.Length)
{
Texts[htTexts(TextSelection)].Text = CSongs.Categories[song].Name;
CBackgroundMusic.Play();
@@ -304,11 +304,10 @@ namespace Vocaluxe.Screens
id = CSongs.VisibleSongs[song].ID;
}
// here is a fault: SetSelectedSong should point to the visible index
Vocaluxe.Lib.Song.CSong s = Array.Find<Vocaluxe.Lib.Song.CSong>(CSongs.VisibleSongs, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (s != null && s.ID > -1)
int visibleID = Array.FindIndex<Vocaluxe.Lib.Song.CSong>(CSongs.VisibleSongs, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID > -1)
{
id = s.ID;
id = visibleID;
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(id);
}
}
@@ -345,4 +344,4 @@ namespace Vocaluxe.Screens
SongMenus[htSongMenus(SongMenu)].OnShow();
}
}
}
}