diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs
index d6e3fd83..dfaf8f01 100644
--- a/Source/OpenTK/GameWindow.cs
+++ b/Source/OpenTK/GameWindow.cs
@@ -145,20 +145,40 @@ namespace OpenTK
#region --- INativeGLWindow Members ---
- #region public void Exit()
+ #region public virtual void Exit()
///
- /// Gracefully exits the current GameWindow.
- /// Override if you want to provide yor own exit sequence.
- /// If you override this method, place a call to base.Exit(), to ensure
- /// proper OpenTK shutdown.
+ /// Gracefully exits the GameWindow. May be called from any thread.
///
+ ///
+ /// Override if you want to provide yor own exit sequence.
+ /// If you override this method, place a call to base.Exit(), to ensure
+ /// proper OpenTK shutdown.
+ ///
public virtual void Exit()
{
isExiting = true;
+ UpdateFrame += GameWindow_UpdateFrame;
+ }
+
+ #endregion
+
+ #region void ExitInternal()
+
+ ///
+ /// Stops the main loop.
+ ///
+ void ExitInternal()
+ {
throw new GameWindowExitException();
}
+ void GameWindow_UpdateFrame(GameWindow sender, UpdateFrameEventArgs e)
+ {
+ UpdateFrame -= GameWindow_UpdateFrame;
+ sender.ExitInternal();
+ }
+
#endregion
#region public bool IsIdle
@@ -433,15 +453,15 @@ namespace OpenTK
//sleep_granularity = System.Math.Round(1000.0 * update_watch.Elapsed.TotalSeconds / test_times, MidpointRounding.AwayFromZero) / 1000.0;
//update_watch.Reset(); // We don't want to affect the first UpdateFrame!
- try
- {
+ //try
+ //{
OnLoadInternal(EventArgs.Empty);
- }
- catch (Exception e)
- {
- Trace.WriteLine(String.Format("OnLoad failed: {0}", e.ToString()));
- return;
- }
+ //}
+ //catch (Exception e)
+ //{
+ // Trace.WriteLine(String.Format("OnLoad failed: {0}", e.ToString()));
+ // return;
+ //}
Debug.Print("Elevating priority.");
Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
@@ -1200,6 +1220,36 @@ namespace OpenTK
*/
#endregion
+ #region PointToClient
+
+ ///
+ /// Converts the screen coordinates of a specified point on the screen to client-area coordinates.
+ ///
+ /// A System.Drawing.Point structure that specifies the screen coordinates to be converted
+ /// The client-area coordinates of the point. The new coordinates are relative to the upper-left corner of the GameWindow's client area.
+ public System.Drawing.Point PointToClient(System.Drawing.Point p)
+ {
+ glWindow.PointToClient(ref p);
+ return p;
+ }
+
+ #endregion
+
+ #region PointToScreen
+
+ ///
+ /// Converts the client-area coordinates of a specified point to screen coordinates.
+ ///
+ /// A System.Drawing.Point structure that specifies the client-area coordinates to be converted
+ /// The screen coordinates of the point, relative to the upper-left corner of the screen. Note, a screen-coordinate point that is above the window's client area has a negative y-coordinate. Similarly, a screen coordinate to the left of a client area has a negative x-coordinate.
+ public System.Drawing.Point PointToScreen(System.Drawing.Point p)
+ {
+ glWindow.PointToScreen(ref p);
+ return p;
+ }
+
+ #endregion
+
#region --- IDisposable Members ---
///
@@ -1247,7 +1297,7 @@ namespace OpenTK
#region public enum VSyncMode
///
- /// Enumerates the available VSync modes.
+ /// Enumerates available VSync modes.
///
public enum VSyncMode
{