screen_save

Saves a screenshot of the game as a *.png.

Syntax:

screen_save(fname);


Argument Description
fname The filename for the screenshot to save


Returns: N/A


Description

With this function you can save a screenshot of the game as it currently appears in the game window or browser. The file will be saved to the working directory of the game, which in windows is located at "C:\Users\YOURUSERNAME\AppData\Local\YOURGAMENAME\" This is an image of the whole display region and not just a specific section or view and your are saving out what is being drawn to the back buffer at the time, meaning that depending on where you call the function the results will differ. If you don't want the GUI layer, then you can save the screen before rendering the GUI (ie: in the Draw event), but if you do want GUI elements to be included, then you save after the Draw GUI event. Should you need more control, you should use the function screen_save_part.

NOTE: This function does not work on the HTML5 target.


Example:

if keyboard_check_pressed(ord("S"))
   {
   screen_save(working_directory + "\Screens\Screen_"+string(num)+".png")
   num += 1;
   }

The above code takes a screenshot of the game when the user presses the "S" key. This screen shot is saved to a specific directory and numbered using a variable which is then incremented.


Back: Windows and Views
Next: screen_save_part
© Copyright YoYo Games Ltd. 2017 All Rights Reserved