diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index de49c4ca..89dfea46 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -275,7 +275,7 @@ namespace OpenTK /// proper OpenTK shutdown. /// public virtual void Exit() - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); //glWindow.DestroyWindow(); //while (glWindow.Exists) @@ -302,7 +302,7 @@ namespace OpenTK /// public virtual void ExitAsync() { - //isExiting = true; + //isExiting = true; if (disposed) throw new ObjectDisposedException("GameWindow"); UpdateFrame += CallExitInternal; } @@ -343,10 +343,10 @@ namespace OpenTK /// public IGraphicsContext Context { - get - { - if (disposed) throw new ObjectDisposedException("GameWindow"); - return glContext; + get + { + if (disposed) throw new ObjectDisposedException("GameWindow"); + return glContext; } } @@ -372,12 +372,12 @@ namespace OpenTK public string Title { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); return glWindow.Title; } set - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); glWindow.Title = value; } @@ -443,7 +443,7 @@ namespace OpenTK /// (while the opengl context still exists), to allow resource cleanup. /// public void DestroyWindow() - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (Exists) glWindow.DestroyWindow(); @@ -460,7 +460,7 @@ namespace OpenTK /// /// public void Run() - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); Run(0.0, 0.0); } @@ -471,7 +471,7 @@ namespace OpenTK /// /// public void Run(double updateFrequency) - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); Run(updateFrequency, 0.0); } @@ -482,7 +482,7 @@ namespace OpenTK /// The frequency of UpdateFrame events. /// The frequency of RenderFrame events. public void Run(double updates_per_second, double frames_per_second) - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); try { @@ -628,9 +628,9 @@ namespace OpenTK if (Exists) { - glContext.Dispose(); + glContext.Dispose(); glContext = null; - glWindow.DestroyWindow(); + glWindow.DestroyWindow(); } while (this.Exists) this.ProcessEvents(); @@ -653,7 +653,7 @@ namespace OpenTK /// /// public void ProcessEvents() - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (!isExiting) glWindow.InputDriver.Poll(); @@ -676,7 +676,7 @@ namespace OpenTK /// /// private void OnRenderFrameInternal(RenderFrameEventArgs e) - { + { if (RenderFrame != null) RenderFrame(this, e); @@ -692,7 +692,7 @@ namespace OpenTK /// The base implementation (base.OnRenderFrame) is empty, there is no need to call it. /// public virtual void OnRenderFrame(RenderFrameEventArgs e) - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); } @@ -731,7 +731,7 @@ namespace OpenTK /// The base implementation (base.OnUpdateFrame) is empty, there is no need to call it. /// public virtual void OnUpdateFrame(UpdateFrameEventArgs e) - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); } @@ -782,7 +782,7 @@ namespace OpenTK /// /// Not used. public virtual void OnLoad(EventArgs e) - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); } @@ -815,7 +815,7 @@ namespace OpenTK /// /// Not used. public virtual void OnUnload(EventArgs e) - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); } @@ -844,7 +844,7 @@ namespace OpenTK public KeyboardDevice Keyboard { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); //if (input_driver.Keyboard.Count > 0) // return input_driver.Keyboard[0]; @@ -868,7 +868,7 @@ namespace OpenTK public MouseDevice Mouse { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); //if (input_driver.Mouse.Count > 0) // return input_driver.Mouse[0]; @@ -892,12 +892,12 @@ namespace OpenTK public VSyncMode VSync { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); return vsync; } set - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (value == VSyncMode.Off) Context.VSync = false; @@ -918,7 +918,7 @@ namespace OpenTK /// /// Calling this function is equivalent to calling Context.SwapBuffers() public void SwapBuffers() - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); this.Context.SwapBuffers(); } @@ -952,12 +952,12 @@ namespace OpenTK public double TargetRenderPeriod { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); return target_render_period; } set - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (value <= 0.005) { @@ -986,14 +986,14 @@ namespace OpenTK public double TargetRenderFrequency { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (TargetRenderPeriod == 0.0) return 0.0; return 1.0 / TargetRenderPeriod; } set - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (value < 1.0) { @@ -1021,12 +1021,12 @@ namespace OpenTK public double TargetUpdatePeriod { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); return target_update_period; } set - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (value <= 0.005) { @@ -1054,14 +1054,14 @@ namespace OpenTK public double TargetUpdateFrequency { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (TargetUpdatePeriod == 0.0) return 0.0; return 1.0 / TargetUpdatePeriod; } set - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (value < 1.0) { @@ -1085,7 +1085,7 @@ namespace OpenTK public double RenderFrequency { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (render_period == 0.0) return 1.0; @@ -1103,7 +1103,7 @@ namespace OpenTK public double RenderPeriod { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); return render_period; } @@ -1119,7 +1119,7 @@ namespace OpenTK public double UpdateFrequency { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (update_period == 0.0) return 1.0; @@ -1137,7 +1137,7 @@ namespace OpenTK public double UpdatePeriod { get - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); return update_period; } @@ -1183,7 +1183,7 @@ namespace OpenTK { get { if (disposed) throw new ObjectDisposedException("GameWindow"); return width; } set - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (value == this.Width) { @@ -1211,7 +1211,7 @@ namespace OpenTK { get { if (disposed) throw new ObjectDisposedException("GameWindow"); return height; } set - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); if (value == this.Height) { @@ -1267,7 +1267,7 @@ namespace OpenTK /// /// Contains information about the Resize event. protected virtual void OnResize(ResizeEventArgs e) - { + { if (disposed) throw new ObjectDisposedException("GameWindow"); } @@ -1344,8 +1344,8 @@ namespace OpenTK /// Disposes of the GameWindow, releasing all resources consumed by it. /// public virtual void Dispose() - { - if (disposed) throw new ObjectDisposedException("GameWindow"); + { + if (disposed) throw new ObjectDisposedException("GameWindow"); Dispose(true); GC.SuppressFinalize(this); } @@ -1356,10 +1356,10 @@ namespace OpenTK { if (manual) { - if (glContext != null) + if (glContext != null) { - glContext.Dispose(); - glContext = null; + glContext.Dispose(); + glContext = null; } if (glWindow != null)