Pages: 1
  Print  
Author Topic: Screen Save Screen-shot code snippet  (Read 6288 times)
Offline (Male) hpg678
Posted on: May 17, 2019, 07:19:18 am

Member
Location: Barbados
Joined: Mar 2017
Posts: 283

View Profile Email
Here's a little work-a-round using code to save a screen-shot of your games.


in an object in the Create Event, create a variable 'num = 0'; This is to track auto-numbering of the generic filename to save the screen-shot.


In the 'keyboard_released_letter' event e.g i used "S" place this code

Code: [Select]

var screenshot = background_create_from_screen(0,0, window_get_width(), window_get_height(), false, true);
fname = get_save_filename("Save screenshot (*.png)|*.png", "screenshot"+string(num)+".png");
if (fname != "")
{
   //background_save(screenshot, "screenshot_"+(string(num))+".png"); //use this for automatic screenshot numbering
   background_save(screenshot, fname); //use if you want to give custom filename
   num += 1; // you can leave this
}
else
{
   show_error("File not saved!", false)
}


Please note that in Linux you would need to have a Dialog API set to either Zenity or Kdialog for it to work.





« Last Edit: May 17, 2019, 07:27:00 am by hpg678 » Logged
[compromised account]
Offline (Male) Goombert
Reply #1 Posted on: May 17, 2019, 04:54:21 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
Thanks for the tip hugar! If I may ask, is this suggestion a result of issues you faced with [snip]screen_save[/snip] function which is implemented? I actually ran onto this myself working on the screen cleanup which will be merged soon. If you save as bmp instead of png, it may fix it. I will send a pull request to fix it after the cleanup is finished.
https://github.com/enigma-dev/enigma-dev/pull/1725
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) Goombert
Reply #2 Posted on: May 17, 2019, 07:02:12 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
Ok the libpng/flipped saving is now fixed, just wait for it to be reviewed.
https://github.com/enigma-dev/enigma-dev/pull/1728
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: 1
  Print