Implement resize event in GameWindow.

This commit is contained in:
kanato 2009-02-11 07:59:24 +00:00
parent b921bf95dd
commit b99e8c5829

View file

@ -175,14 +175,23 @@ namespace OpenTK
if ((options & GameWindowFlags.Fullscreen) != 0) if ((options & GameWindowFlags.Fullscreen) != 0)
{ {
device.ChangeResolution(width, height, mode.ColorFormat.BitsPerPixel, 0); device.ChangeResolution(width, height, mode.ColorFormat.BitsPerPixel, 0);
//this.Fullscreen = true; this.WindowState = WindowState.Fullscreen;
throw new NotImplementedException(); //throw new NotImplementedException();
} }
this.VSync = VSyncMode.On; //VSyncMode.Adaptive; this.VSync = VSyncMode.On; //VSyncMode.Adaptive;
glWindow.Resize += new ResizeEvent(glWindow_Resize);
} }
void glWindow_Resize(object sender, ResizeEventArgs e)
{
Debug.Print("glWindow_Resize event fired.");
OnResizeInternal(e);
}
#endregion #endregion
/// <summary> /// <summary>
@ -1269,11 +1278,7 @@ namespace OpenTK
/// <summary> /// <summary>
/// Occurs when the GameWindow is resized. Derived classes should override the OnResize method for better performance. /// Occurs when the GameWindow is resized. Derived classes should override the OnResize method for better performance.
/// </summary> /// </summary>
public event ResizeEvent Resize public event ResizeEvent Resize;
{
add { if (disposed) throw new ObjectDisposedException("GameWindow"); glWindow.Resize += value; }
remove { if (disposed) throw new ObjectDisposedException("GameWindow"); glWindow.Resize -= value; }
}
/// <summary> /// <summary>
/// Raises the Resize event. /// Raises the Resize event.
@ -1286,8 +1291,8 @@ namespace OpenTK
this.width = e.Width; this.width = e.Width;
this.height = e.Height; this.height = e.Height;
//if (this.Resize != null) if (this.Resize != null)
// this.Resize(this, e); this.Resize(this, e);
OnResize(e); OnResize(e);
} }