diff --git a/Example - Save png screenshot of window.monkey2 b/Example - Save png screenshot of window.monkey2 new file mode 100644 index 0000000..43012a2 --- /dev/null +++ b/Example - Save png screenshot of window.monkey2 @@ -0,0 +1,32 @@ +#Import "" +#Import "" + +Using std.. +Using mojo.. + + +Class MyWindow Extends Window + + Method New() + End method + + Method OnRender( canvas:Canvas ) Override + App.RequestRender() ' Activate this method + ' Press space to make screenshot..... + If Keyboard.KeyReleased(Key.Space) + Local filename:String=DesktopDir()+"screenshot.png" + Local screenshot:Pixmap = canvas.CopyPixmap(New Recti(0, 0, Width, Height)) + SavePixmap(screenshot, filename) + Print "Screenshot saved as : "+filename + End If + ' if key escape then quit + If Keyboard.KeyReleased(Key.Escape) Then App.Terminate() + End Method + +End Class + +Function Main() + New AppInstance + New MyWindow + App.Run() +End Function