gd: added input addon
This commit is contained in:
18
guide_examples/remapping/utils.gd
Normal file
18
guide_examples/remapping/utils.gd
Normal file
@ -0,0 +1,18 @@
|
||||
const REMAPPING_CONFIG_PATH = "user://remapping_config.tres"
|
||||
|
||||
# Constants for custom data that we store in the remapping config.
|
||||
const CUSTOM_DATA_INVERT_HORIZONTAL = "invert_horizontal"
|
||||
const CUSTOM_DATA_INVERT_VERTICAL = "invert_vertical"
|
||||
|
||||
## Loads the saved remapping config if it exists, or an empty remapping
|
||||
## config if none exists.
|
||||
static func load_remapping_config() -> GUIDERemappingConfig:
|
||||
if ResourceLoader.exists(REMAPPING_CONFIG_PATH):
|
||||
return ResourceLoader.load(REMAPPING_CONFIG_PATH)
|
||||
else:
|
||||
return GUIDERemappingConfig.new()
|
||||
|
||||
## Saves the given remapping config to the user folder
|
||||
static func save_remapping_config(config:GUIDERemappingConfig) -> void:
|
||||
ResourceSaver.save(config, REMAPPING_CONFIG_PATH)
|
||||
config.take_over_path(REMAPPING_CONFIG_PATH)
|
Reference in New Issue
Block a user