diff --git a/export_presets.cfg b/export_presets.cfg index e019667..5d2f487 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -7,7 +7,7 @@ advanced_options=true dedicated_server=false custom_features="" export_filter="all_resources" -include_filter="" +include_filter="resources/kle/README.txt" exclude_filter="" export_path="build/windows/keebie.exe" patches=PackedStringArray() diff --git a/resources/kle/README.txt b/resources/kle/README.txt new file mode 100644 index 0000000..96b7196 --- /dev/null +++ b/resources/kle/README.txt @@ -0,0 +1,11 @@ +Here you can add custom physical layouts. + +Layouts can be created and edited in Keyboard Layout Editor: +https://www.keyboard-layout-editor.com + +Once you've created the layout, export it in JSON format (Download > Download JSON) +and put the JSON file in this directory. + +Keep in mind that key labels should adhere to the standard US QWERTY layout, +so that the game could correctly infer their keycodes. +You can configure your keyboard's actual labels in the game itself. diff --git a/scripts/globals/layout_config.gd b/scripts/globals/layout_config.gd index 5c06782..4c8f8c5 100644 --- a/scripts/globals/layout_config.gd +++ b/scripts/globals/layout_config.gd @@ -4,6 +4,7 @@ signal layout_swapped(new_layout: AbstractLayout) const CONFIG_PATH := "user://layout.cfg" const CUSTOM_LAYOUTS_PATH := "user://custom_layouts" +const CUSTOM_LAYOUTS_README := "res://resources/kle/README.txt" const SECTION_INFO := "info" const SECTION_KEYS := "keys" const PARAM_NAME := "name" @@ -145,9 +146,15 @@ func _save_config() -> Error: func _load_custom_layouts(path: String) -> void: if not DirAccess.dir_exists_absolute(path): - var err := DirAccess.make_dir_absolute(path) - if err != OK: - printerr("error creating directory '%s': %s" % [path, err]) + var dir_err := DirAccess.make_dir_absolute(path) + if dir_err != OK: + printerr("error creating directory '%s': %s" % [path, dir_err]) + return + var file_err := DirAccess.copy_absolute( + CUSTOM_LAYOUTS_README, path.path_join(CUSTOM_LAYOUTS_README.get_file()) + ) + if file_err != OK: + printerr("error copying file '%s': %s" % [CUSTOM_LAYOUTS_README, file_err]) var dir := DirAccess.open(path) if not dir: