added border adjustment (ctrl+alt+shift + left/right). some tvs have borders which can't be deactivated.

This commit is contained in:
Alexander Eckart authored and Florian Küpper committed 2013-12-26 13:03:21 +01:00
1 parent e2986c0f46
commit 4e30a43cea
3 files changed
+74 -8

No files matched your search

+17
View File
@@ -60,6 +60,11 @@ namespace Vocaluxe.Base
public static int ScreenW = 1024;
public static int ScreenH = 576;
public static int BorderLeft = 0;
public static int BorderRight = 0;
public static int BorderTop = 0;
public static int BorderBottom = 0;
public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0;
public static EOffOn VSync = EOffOn.TR_CONFIG_ON;
@@ -183,6 +188,12 @@ namespace Vocaluxe.Base
xmlReader.TryGetIntValue("//root/Graphics/ScreenW", ref ScreenW);
xmlReader.TryGetIntValue("//root/Graphics/ScreenH", ref ScreenH);
xmlReader.TryGetIntValue("//root/Graphics/BorderLeft", ref BorderLeft);
xmlReader.TryGetIntValue("//root/Graphics/BorderRight", ref BorderRight);
xmlReader.TryGetIntValue("//root/Graphics/BorderTop", ref BorderTop);
xmlReader.TryGetIntValue("//root/Graphics/BorderBottom", ref BorderBottom);
xmlReader.TryGetEnumValue("//root/Graphics/AAMode", ref AAMode);
xmlReader.TryGetFloatValue("//root/Graphics/MaxFPS", ref MaxFPS);
xmlReader.TryGetEnumValue("//root/Graphics/VSync", ref VSync);
@@ -356,6 +367,12 @@ namespace Vocaluxe.Base
writer.WriteElementString("ScreenW", ScreenW.ToString());
writer.WriteElementString("ScreenH", ScreenH.ToString());
writer.WriteComment("Screen borders (pixels)");
writer.WriteElementString("BorderLeft", BorderLeft.ToString());
writer.WriteElementString("BorderRight", BorderRight.ToString());
writer.WriteElementString("BorderTop", BorderTop.ToString());
writer.WriteElementString("BorderBottom", BorderBottom.ToString());
writer.WriteComment("AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes))));
writer.WriteElementString("AAMode", Enum.GetName(typeof(EAntiAliasingModes), AAMode));
+23
View File
@@ -378,6 +378,29 @@ namespace Vocaluxe.Base
{
CSettings.MouseInactive();
_Cursor.FadeOut();
if (keyEvent.ModAlt && keyEvent.ModCtrl && keyEvent.ModShift)
{
switch (keyEvent.Key)
{
case Keys.Left:
CConfig.BorderLeft -= 1;
CConfig.BorderRight -= 1;
CConfig.BorderTop -= 1;
CConfig.BorderBottom -= 1;
break;
case Keys.Right:
CConfig.BorderLeft += 1;
CConfig.BorderRight += 1;
CConfig.BorderTop += 1;
CConfig.BorderBottom += 1;
break;
default:
break;
}
CConfig.SaveConfig();
break;
}
}
if (keyEvent.Key == Keys.F11)
+34 -8
View File
@@ -65,6 +65,11 @@ namespace Vocaluxe.Lib.Draw
private int _Y;
private int _X;
private int _BorderLeft = 0;
private int _BorderRight = 0;
private int _BorderTop = 0;
private int _BorderBottom = 0;
private CTexture _BlankTexture;
private readonly Queue<STexturedColoredVertex> _Vertices = new Queue<STexturedColoredVertex>();
@@ -400,20 +405,15 @@ namespace Vocaluxe.Lib.Draw
if (_Device.Disposed)
return false;
Text = CSettings.GetFullVersionText();
SlimDX.Matrix translate = SlimDX.Matrix.Translation(new Vector3(-(float)CSettings.RenderW / 2, (float)CSettings.RenderH / 2, 0));
SlimDX.Matrix projection = SlimDX.Matrix.OrthoOffCenterLH(-(float)CSettings.RenderW / 2, (float)CSettings.RenderW / 2, -(float)CSettings.RenderH / 2,
(float)CSettings.RenderH / 2,
CSettings.ZNear, CSettings.ZFar);
_AdjustNewBorders();
_VertexBuffer = new VertexBuffer(_Device, CSettings.VertexBufferElements * (4 * Marshal.SizeOf(typeof(STexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic,
VertexFormat.Position | VertexFormat.Texture1 | VertexFormat.Diffuse, Pool.Default);
if (_Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(STexturedColoredVertex))).IsFailure)
CLog.LogError("Failed to set stream source");
_Device.VertexDeclaration = STexturedColoredVertex.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)
@@ -534,6 +534,18 @@ namespace Vocaluxe.Lib.Draw
else
_LeaveFullScreen();
}
//Apply border changes
if (_BorderLeft != CConfig.BorderLeft || _BorderRight != CConfig.BorderRight || _BorderTop != CConfig.BorderTop || _BorderBottom != CConfig.BorderBottom)
{
_BorderLeft = CConfig.BorderLeft;
_BorderRight = CConfig.BorderRight;
_BorderTop = CConfig.BorderTop;
_BorderBottom = CConfig.BorderBottom;
_AdjustNewBorders();
}
if (CTime.IsRunning())
delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds());
@@ -559,6 +571,20 @@ namespace Vocaluxe.Lib.Draw
CLog.LogError("Failed to reset the device");
}
private void _AdjustNewBorders()
{
SlimDX.Matrix translate = SlimDX.Matrix.Translation(new Vector3(-(float)CSettings.RenderW / 2, (float)CSettings.RenderH / 2, 0));
SlimDX.Matrix projection = SlimDX.Matrix.OrthoOffCenterLH(
-(float)CSettings.RenderW / 2 - _BorderLeft, (float)CSettings.RenderW / 2 + _BorderRight,
-(float)CSettings.RenderH / 2 - _BorderBottom, (float)CSettings.RenderH / 2 + _BorderTop,
CSettings.ZNear, CSettings.ZFar);
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");
}
/// <summary>
/// Unloads all Textures and other objects used by Direct3D for rendering
/// </summary>