Fix initial resize of OGL

This commit is contained in:
Flamefire committed 2014-09-13 01:22:56 +02:00
1 parent 4a068f113e
commit 128abf61b9
3 files changed
+10 -20

No files matched your search

+2 -15
View File
@@ -49,8 +49,6 @@ namespace Vocaluxe.Lib.Draw
private readonly Device _Device;
private readonly PresentParameters _PresentParameters;
private Size _SizeBeforeMinimize;
private VertexBuffer _VertexBuffer;
private IndexBuffer _IndexBuffer;
@@ -93,9 +91,6 @@ namespace Vocaluxe.Lib.Draw
_Form.MouseLeave += _OnMouseLeave;
_Form.MouseEnter += _OnMouseEnter;
_Form.ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
_SizeBeforeMinimize = _Form.ClientSize;
_PresentParameters = new PresentParameters
{
Windowed = true,
@@ -175,8 +170,6 @@ namespace Vocaluxe.Lib.Draw
true, true);
}
}
_CenterToScreen();
}
#region form events
@@ -200,13 +193,13 @@ namespace Vocaluxe.Lib.Draw
if (_W / (float)_H > CSettings.GetRenderAspect())
{
//The windows's width is too big
//The windows width is too big
_W = (int)Math.Round(_H * CSettings.GetRenderAspect());
_X = (_Form.ClientSize.Width - _W) / 2;
}
else
{
//The windows's height is too big
//The windows height is too big
_H = (int)Math.Round(_W / CSettings.GetRenderAspect());
_Y = (_Form.ClientSize.Height - _H) / 2;
}
@@ -580,7 +573,6 @@ namespace Vocaluxe.Lib.Draw
#region Textures
#region adding
protected override Texture _CreateTexture(CTexture texture, byte[] data)
{
//Create a new texture in the managed pool, which does not need to be recreated on a lost device
@@ -608,9 +600,7 @@ namespace Vocaluxe.Lib.Draw
}
t.UnlockRectangle(0);
}
#endregion adding
#region updating
/// <summary>
/// Updates the data of a texture
/// </summary>
@@ -637,7 +627,6 @@ namespace Vocaluxe.Lib.Draw
}
return true;
}
#endregion updating
#region drawing
/// <summary>
@@ -921,7 +910,6 @@ namespace Vocaluxe.Lib.Draw
}
#endregion utility
#region TexturedColoredVertex
private struct STexturedColoredVertex
{
private static VertexDeclaration _Declaration;
@@ -954,6 +942,5 @@ namespace Vocaluxe.Lib.Draw
return _Declaration;
}
}
#endregion TexturedColoredVertex
}
}
+5
View File
@@ -26,6 +26,7 @@ namespace Vocaluxe.Lib.Draw
protected Form _Form;
private SClientRect _Restore;
protected Size _SizeBeforeMinimize;
public override void Unload()
{
@@ -179,6 +180,10 @@ namespace Vocaluxe.Lib.Draw
_Form.Resize += _OnResize;
_Form.Load += _OnLoad;
_Form.ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
_SizeBeforeMinimize = _Form.ClientSize;
_CenterToScreen();
return true;
}
+3 -5
View File
@@ -136,10 +136,6 @@ namespace Vocaluxe.Lib.Draw
_Control.MouseLeave += _OnMouseLeave;
_Control.MouseEnter += _OnMouseEnter;
_Form.ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
_CenterToScreen();
_NonPowerOf2TextureSupported = false;
}
@@ -220,14 +216,15 @@ namespace Vocaluxe.Lib.Draw
_Y = 0;
_X = 0;
if (_W / (float)_H > CSettings.GetRenderAspect())
{
//The windows width is too big
_W = (int)Math.Round(_H * CSettings.GetRenderAspect());
_X = (_Control.Width - _W) / 2;
}
else
{
//The windows height is too big
_H = (int)Math.Round(_W / CSettings.GetRenderAspect());
_Y = (_Control.Height - _H) / 2;
}
@@ -268,6 +265,7 @@ namespace Vocaluxe.Lib.Draw
protected override void _OnAfterDraw()
{
_Control.SwapBuffers();
Application.DoEvents();
}
public int GetScreenWidth()