The Resize event is now fired before the Load event.

This commit is contained in:
the_fiddler 2007-10-20 10:28:02 +00:00
parent 6559df8533
commit ac2d5046b8

View file

@ -325,7 +325,6 @@ namespace OpenTK
try try
{ {
glWindow.CreateWindow(mode); glWindow.CreateWindow(mode);
} }
catch (ApplicationException expt) catch (ApplicationException expt)
{ {
@ -573,6 +572,13 @@ namespace OpenTK
//if (!isExiting) //if (!isExiting)
// InputDriver.Poll(); // InputDriver.Poll();
glWindow.ProcessEvents(); glWindow.ProcessEvents();
if (MustResize)
{
resizeEventArgs.Width = glWindow.Width;
resizeEventArgs.Height = glWindow.Height;
OnResizeInternal(resizeEventArgs);
}
} }
#endregion #endregion
@ -622,16 +628,10 @@ namespace OpenTK
{ {
if (!this.Exists && !this.IsExiting) if (!this.Exists && !this.IsExiting)
{ {
Debug.Print("WARNING: UpdateFrame event raised without a valid render window. This may indicate a programming error. Creating render window."); //Debug.Print("WARNING: UpdateFrame event raised without a valid render window. This may indicate a programming error. Creating render window.");
mode = new DisplayMode(640, 480); //mode = new DisplayMode(640, 480);
this.CreateWindow(mode); //this.CreateWindow(mode);
} throw new InvalidOperationException("Cannot enter game loop without a render window");
if (MustResize)
{
resizeEventArgs.Width = glWindow.Width;
resizeEventArgs.Height = glWindow.Height;
OnResizeInternal(resizeEventArgs);
} }
if (UpdateFrame != null) if (UpdateFrame != null)
@ -673,6 +673,13 @@ namespace OpenTK
/// <param name="e"></param> /// <param name="e"></param>
private void OnLoadInternal(EventArgs e) private void OnLoadInternal(EventArgs e)
{ {
if (MustResize)
{
resizeEventArgs.Width = glWindow.Width;
resizeEventArgs.Height = glWindow.Height;
OnResizeInternal(resizeEventArgs);
}
Debug.WriteLine(String.Format("OpenGL driver information: {0}, {1}, {2}", Debug.WriteLine(String.Format("OpenGL driver information: {0}, {1}, {2}",
GL.GetString(GL.Enums.StringName.RENDERER), GL.GetString(GL.Enums.StringName.RENDERER),
GL.GetString(GL.Enums.StringName.VENDOR), GL.GetString(GL.Enums.StringName.VENDOR),