mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-18 21:27:41 +00:00
Added screenshot capabilities on F12.
This commit is contained in:
parent
80bde7f7ac
commit
0a8f1a9c6a
|
@ -165,6 +165,28 @@ namespace Examples.Tutorial
|
||||||
bitmap.UnlockBits(data);
|
bitmap.UnlockBits(data);
|
||||||
}
|
}
|
||||||
#endregion Textures
|
#endregion Textures
|
||||||
|
|
||||||
|
Keyboard.KeyUp += KeyUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
void KeyUp(OpenTK.Input.KeyboardDevice sender, OpenTK.Input.Key e)
|
||||||
|
{
|
||||||
|
if (e == OpenTK.Input.Key.F12)
|
||||||
|
{
|
||||||
|
Bitmap bmp = new Bitmap(this.Width, this.Height);
|
||||||
|
System.Drawing.Imaging.BitmapData data =
|
||||||
|
bmp.LockBits(new Rectangle(0, 0, this.Width, this.Height),
|
||||||
|
System.Drawing.Imaging.ImageLockMode.WriteOnly,
|
||||||
|
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
|
||||||
|
GL.ReadPixels(0, 0, this.Width, this.Height,
|
||||||
|
OpenTK.Graphics.PixelFormat.Bgr,
|
||||||
|
OpenTK.Graphics.PixelType.UnsignedByte,
|
||||||
|
data.Scan0);
|
||||||
|
bmp.UnlockBits(data);
|
||||||
|
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||||
|
bmp.Save("Screenshot" + (i++).ToString() + ".png", ImageFormat.Png);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue