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:

View File

@@ -478,6 +478,11 @@ ui_reset_keybindings={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194336,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
ui_screenshot={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194333,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[internationalization]