Add a screenshot feature (#439)

This commit is contained in:
Jeod
2025-10-01 15:27:57 -04:00
committed by GitHub
parent f89a48905b
commit 77d0e9f6c3
2 changed files with 15 additions and 1 deletions

View File

@@ -183,7 +183,8 @@ func setup_config_dirs() -> void:
"logs",
"marathon_recordings",
"resource_packs",
"saves"
"saves",
"screenshots"
]
for d in dirs:
@@ -244,6 +245,14 @@ func _process(delta: float) -> void:
AudioManager.play_global_sfx("switch")
debug_mode = true
log_comment("Debug Mode enabled! some bugs may occur!")
if Input.is_action_just_pressed("ui_screenshot"):
take_screenshot()
func take_screenshot() -> void:
var img: Image = get_viewport().get_texture().get_image()
var filename = Global.config_path.path_join("screenshots/screenshot_" + str(int(Time.get_unix_time_from_system())) + ".png")
var err = img.save_png(filename)
func handle_p_switch(delta: float) -> void:
if p_switch_active and get_tree().paused == false: