mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-06-01 22:00:25 +00:00
Don't use obsolete DisplayMode.Width/Height anymore.
This commit is contained in:
parent
565f40f764
commit
5b44be105c
|
@ -36,6 +36,7 @@ namespace OpenTK.Platform.Windows
|
||||||
private bool exists;
|
private bool exists;
|
||||||
private WindowInfo window = new WindowInfo();
|
private WindowInfo window = new WindowInfo();
|
||||||
private int top, bottom, left, right;
|
private int top, bottom, left, right;
|
||||||
|
private int width = 0, height = 0;
|
||||||
|
|
||||||
private ResizeEventArgs resizeEventArgs = new ResizeEventArgs();
|
private ResizeEventArgs resizeEventArgs = new ResizeEventArgs();
|
||||||
|
|
||||||
|
@ -44,11 +45,6 @@ namespace OpenTK.Platform.Windows
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private MSG myGoodMsg = new MSG();
|
private MSG myGoodMsg = new MSG();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// For use in WndProc only.
|
|
||||||
/// </summary>
|
|
||||||
private int width = 0, height = 0;
|
|
||||||
|
|
||||||
private int left_border, right_border, top_border, bottom_border;
|
private int left_border, right_border, top_border, bottom_border;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -78,15 +74,15 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
case WindowMessage.WINDOWPOSCHANGED:
|
case WindowMessage.WINDOWPOSCHANGED:
|
||||||
// Get window size
|
// Get window size
|
||||||
width = Marshal.ReadInt32(m.LParam, (int)Marshal.OffsetOf(typeof(WindowPosition), "cx"));
|
int _width = Marshal.ReadInt32(m.LParam, (int)Marshal.OffsetOf(typeof(WindowPosition), "cx"));
|
||||||
height = Marshal.ReadInt32(m.LParam, (int)Marshal.OffsetOf(typeof(WindowPosition), "cy"));
|
int _height = Marshal.ReadInt32(m.LParam, (int)Marshal.OffsetOf(typeof(WindowPosition), "cy"));
|
||||||
width -= (left_border + right_border);
|
_width -= (left_border + right_border);
|
||||||
height -= (top_border + bottom_border);
|
_height -= (top_border + bottom_border);
|
||||||
//if (resizeEventArgs.Width != width || resizeEventArgs.Height != height)
|
//if (resizeEventArgs.Width != width || resizeEventArgs.Height != height)
|
||||||
if (this.mode.Width != width || this.mode.Height != height)
|
if (width != _width || height != _height)
|
||||||
{
|
{
|
||||||
mode.Width = width;
|
width = _width;
|
||||||
mode.Height = height;
|
height = _height;
|
||||||
// If the size has changed, raise the ResizeEvent.
|
// If the size has changed, raise the ResizeEvent.
|
||||||
//resizeEventArgs.Width = width;
|
//resizeEventArgs.Width = width;
|
||||||
//resizeEventArgs.Height = height;
|
//resizeEventArgs.Height = height;
|
||||||
|
@ -99,10 +95,10 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
case WindowMessage.CREATE:
|
case WindowMessage.CREATE:
|
||||||
// Set the window width and height:
|
// Set the window width and height:
|
||||||
this.mode.Width = Marshal.ReadInt32(m.LParam, (int)Marshal.OffsetOf(typeof(CreateStruct), "cx"));
|
width = Marshal.ReadInt32(m.LParam, (int)Marshal.OffsetOf(typeof(CreateStruct), "cx"));
|
||||||
this.mode.Height = Marshal.ReadInt32(m.LParam, (int)Marshal.OffsetOf(typeof(CreateStruct), "cy"));
|
height = Marshal.ReadInt32(m.LParam, (int)Marshal.OffsetOf(typeof(CreateStruct), "cy"));
|
||||||
this.mode.Width -= (left_border + right_border);
|
width -= (left_border + right_border);
|
||||||
this.mode.Height -= (top_border + bottom_border);
|
height -= (top_border + bottom_border);
|
||||||
|
|
||||||
// Raise the Create event
|
// Raise the Create event
|
||||||
this.OnCreate(EventArgs.Empty);
|
this.OnCreate(EventArgs.Empty);
|
||||||
|
@ -433,11 +429,12 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#region public int Width
|
#region public int Width
|
||||||
|
|
||||||
|
/// <summary>Gets a System.Int32 containing the Width of this GameWindow.</summary>
|
||||||
public int Width
|
public int Width
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mode.Width;
|
return width;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
@ -449,11 +446,12 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#region public int Height
|
#region public int Height
|
||||||
|
|
||||||
|
/// <summary>Gets a System.Int32 containing the Heights of this GameWindow.</summary>
|
||||||
public int Height
|
public int Height
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mode.Height;
|
return height;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue