diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index aa337fe0..47d67190 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -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 /// /// Updates the data of a texture /// @@ -637,7 +627,6 @@ namespace Vocaluxe.Lib.Draw } return true; } - #endregion updating #region drawing /// @@ -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 } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CDrawBaseWindows.cs b/Vocaluxe/Lib/Draw/CDrawBaseWindows.cs index 7f2c31a5..dc8d8256 100644 --- a/Vocaluxe/Lib/Draw/CDrawBaseWindows.cs +++ b/Vocaluxe/Lib/Draw/CDrawBaseWindows.cs @@ -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; } diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index fa22be66..5c0ed946 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -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()