Updated everything to use plain (int width, int height parameters) instead of DisplayMode.Width/.Height.
This commit is contained in:
parent
18ec1d5ad5
commit
d1f2d7b33e
7 changed files with 27 additions and 23 deletions
|
@ -201,7 +201,7 @@ namespace OpenTK
|
|||
// Mono's implementation of Windows.Forms on X11 does not allow the context to
|
||||
// have a different colordepth from the parent. To combat this, we do not set a
|
||||
// specific depth for the DisplayMode - we let the driver select one instead.
|
||||
display_mode.Color = new ColorMode(0);
|
||||
//display_mode.ColorFormat = new ColorMode(0);
|
||||
context = new GLContext(display_mode, info);
|
||||
idle = new PlatformIdle(info);
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ namespace OpenTK
|
|||
{
|
||||
try
|
||||
{
|
||||
glWindow.CreateWindow(mode, out glContext);
|
||||
glWindow.CreateWindow(mode.Width, mode.Height, mode, out glContext);
|
||||
}
|
||||
catch (ApplicationException expt)
|
||||
{
|
||||
|
@ -382,7 +382,7 @@ namespace OpenTK
|
|||
{
|
||||
// TODO: This is a hack - reslove in 0.3.15 once and for all!
|
||||
// GLContext is created inside the CreateWindow call.
|
||||
glWindow.CreateWindow(mode, out glContext);
|
||||
glWindow.CreateWindow(mode.Width, mode.Height, mode, out glContext);
|
||||
this.Title = title;
|
||||
}
|
||||
else
|
||||
|
@ -1153,7 +1153,11 @@ namespace OpenTK
|
|||
/// <summary>
|
||||
/// Occurs when the GameWindow is resized. Derived classes should override the OnResize method for better performance.
|
||||
/// </summary>
|
||||
public event ResizeEvent Resize;
|
||||
public event ResizeEvent Resize
|
||||
{
|
||||
add { glWindow.Resize += value; }
|
||||
remove { glWindow.Resize -= value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the Resize event.
|
||||
|
@ -1165,9 +1169,9 @@ namespace OpenTK
|
|||
|
||||
this.width = e.Width;
|
||||
this.height = e.Height;
|
||||
|
||||
if (this.Resize != null)
|
||||
this.Resize(this, e);
|
||||
|
||||
//if (this.Resize != null)
|
||||
// this.Resize(this, e);
|
||||
|
||||
OnResize(e);
|
||||
}
|
||||
|
@ -1215,7 +1219,7 @@ namespace OpenTK
|
|||
}
|
||||
*/
|
||||
#endregion
|
||||
#if false // TODO: 0.3.15 (Linux support missing)
|
||||
#if false // TODO: 0.9.2 (Linux support missing)
|
||||
#region PointToClient
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace OpenTK.Platform
|
|||
/// </summary>
|
||||
interface INativeGLWindow : IResizable, IDisposable
|
||||
{
|
||||
void CreateWindow(DisplayMode mode, out IGLContext context);
|
||||
void CreateWindow(int width, int height, DisplayMode mode, out IGLContext context);
|
||||
void DestroyWindow();
|
||||
void ProcessEvents();
|
||||
void PointToClient(ref System.Drawing.Point p);
|
||||
|
|
|
@ -334,10 +334,10 @@ namespace OpenTK.Platform.Windows
|
|||
pixelFormat.AccumAlphaBits = (byte)accum.Alpha;
|
||||
}
|
||||
*/
|
||||
pixelFormat.DepthBits = (byte)mode.DepthBits;
|
||||
pixelFormat.StencilBits = (byte)mode.StencilBits;
|
||||
pixelFormat.DepthBits = (byte)mode.Depth;
|
||||
pixelFormat.StencilBits = (byte)mode.Stencil;
|
||||
|
||||
if (mode.DepthBits <= 0)
|
||||
if (mode.Depth <= 0)
|
||||
{
|
||||
pixelFormat.Flags |= PixelFormatDescriptorFlags.DEPTH_DONTCARE;
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
#region public void CreateWindow(DisplayMode mode, out IGLContext context)
|
||||
|
||||
public void CreateWindow(DisplayMode windowMode, out IGLContext context)
|
||||
public void CreateWindow(int width, int height, DisplayMode windowMode, out IGLContext context)
|
||||
{
|
||||
Debug.Print("Creating native window with mode: {0}", windowMode.ToString());
|
||||
Debug.Indent();
|
||||
|
@ -294,21 +294,21 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
Rectangle rect = new Rectangle();
|
||||
rect.top = rect.left = 0;
|
||||
rect.bottom = windowMode.Height;
|
||||
rect.right = windowMode.Width;
|
||||
rect.bottom = height;
|
||||
rect.right = width;
|
||||
Functions.AdjustWindowRect(ref rect, WindowStyle.OverlappedWindow, false);
|
||||
|
||||
// Not used
|
||||
Top = 0;
|
||||
Left = 0;
|
||||
Right = windowMode.Width;
|
||||
Bottom = windowMode.Height;
|
||||
Right = width;
|
||||
Bottom = height;
|
||||
// --------
|
||||
|
||||
top_border = -rect.top;
|
||||
left_border = -rect.left;
|
||||
bottom_border = rect.bottom - windowMode.Height;
|
||||
right_border = rect.right - windowMode.Width;
|
||||
bottom_border = rect.bottom - height;
|
||||
right_border = rect.right - width;
|
||||
|
||||
cp.Width = rect.right - rect.left;
|
||||
cp.Height = rect.bottom - rect.top;
|
||||
|
@ -472,8 +472,8 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
public void OnResize(ResizeEventArgs e)
|
||||
{
|
||||
mode.Width = e.Width;
|
||||
mode.Height = e.Height;
|
||||
this.width = e.Width;
|
||||
this.height = e.Height;
|
||||
if (this.Resize != null)
|
||||
this.Resize(this, e);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace OpenTK.Platform.X11
|
|||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Alpha);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
|
||||
visualAttributes.Add((int)mode.DepthBits);
|
||||
visualAttributes.Add((int)mode.Depth);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
||||
visualAttributes.Add((int)0);
|
||||
}
|
||||
|
|
|
@ -347,7 +347,7 @@ namespace OpenTK.Platform.X11
|
|||
/// Colormap creation is currently disabled.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public void CreateWindow(DisplayMode mode, out IGLContext glContext)
|
||||
public void CreateWindow(int width, int height, DisplayMode mode, out IGLContext glContext)
|
||||
{
|
||||
if (exists)
|
||||
throw new ApplicationException("Render window already exists!");
|
||||
|
|
Loading…
Reference in a new issue