-
-
Save belzecue/3476e9b153c268de214e828d6131f61b to your computer and use it in GitHub Desktop.
Create a folder in the format year-month-day and save the screenshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func screenshot(): | |
var img = get_viewport().get_texture().get_data() | |
img.flip_y() | |
var dir:Directory = Directory.new() | |
var now = OS.get_date() | |
var folder:String = 'user://screenshots/%s-%s-%s' % [now.year,now.month,now.day] | |
dir.make_dir_recursive(folder) | |
img.save_png(folder+'/%d.png' % OS.get_unix_time()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment