This commit is contained in:
parent
44729f595e
commit
510125a0fa
1 changed files with 45 additions and 45 deletions
|
@ -275,7 +275,7 @@ namespace OpenTK
|
|||
/// proper OpenTK shutdown.</para>
|
||||
/// </remarks>
|
||||
public virtual void Exit()
|
||||
{
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||
//glWindow.DestroyWindow();
|
||||
//while (glWindow.Exists)
|
||||
|
@ -302,7 +302,7 @@ namespace OpenTK
|
|||
/// </remarks>
|
||||
public virtual void ExitAsync()
|
||||
{
|
||||
//isExiting = true;
|
||||
//isExiting = true;
|
||||
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||
UpdateFrame += CallExitInternal;
|
||||
}
|
||||
|
@ -343,10 +343,10 @@ namespace OpenTK
|
|||
/// </summary>
|
||||
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.
|
||||
/// </summary>
|
||||
public void DestroyWindow()
|
||||
{
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||
if (Exists)
|
||||
glWindow.DestroyWindow();
|
||||
|
@ -460,7 +460,7 @@ namespace OpenTK
|
|||
/// </summary>
|
||||
/// <see cref="public virtual void Run(double update_frequency, double render_frequency)"/>
|
||||
public void Run()
|
||||
{
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||
Run(0.0, 0.0);
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ namespace OpenTK
|
|||
/// </summary>
|
||||
/// <see cref="public virtual void Run(double updateFrequency, double renderFrequency)"/>
|
||||
public void Run(double updateFrequency)
|
||||
{
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||
Run(updateFrequency, 0.0);
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ namespace OpenTK
|
|||
/// <param name="updates_per_second">The frequency of UpdateFrame events.</param>
|
||||
/// <param name="frames_per_second">The frequency of RenderFrame events.</param>
|
||||
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
|
|||
/// </para>
|
||||
/// </remarks>
|
||||
public void ProcessEvents()
|
||||
{
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||
if (!isExiting)
|
||||
glWindow.InputDriver.Poll();
|
||||
|
@ -676,7 +676,7 @@ namespace OpenTK
|
|||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
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.
|
||||
/// </remarks>
|
||||
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.
|
||||
/// </remarks>
|
||||
public virtual void OnUpdateFrame(UpdateFrameEventArgs e)
|
||||
{
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||
}
|
||||
|
||||
|
@ -782,7 +782,7 @@ namespace OpenTK
|
|||
/// </summary>
|
||||
/// <param name="e">Not used.</param>
|
||||
public virtual void OnLoad(EventArgs e)
|
||||
{
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||
}
|
||||
|
||||
|
@ -815,7 +815,7 @@ namespace OpenTK
|
|||
/// </summary>
|
||||
/// <param name="e">Not used.</param>
|
||||
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
|
|||
/// </summary>
|
||||
/// <remarks>Calling this function is equivalent to calling Context.SwapBuffers()</remarks>
|
||||
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
|
|||
/// </summary>
|
||||
/// <param name="e">Contains information about the Resize event.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue