RetroHubConfig

This class handles all configuration aspects of RetroHub.

Signals

config_ready (config_data: ConfigData)

Emitted when RetroHub has finished loading app configs. This signal is emitted after theme initialization.


config_updated (key: String, old_value: Variant, new_value: Variant)

Emitted when a config value of the app has been updated. key refers to one of the key constants defined in ConfigData, with old_value and new_value representing the old and new values of that config.


theme_config_ready ()

Emitted when RetroHub has finished loading theme configs. This signal is emitted after theme initialization, and configurations can be retrieved with get_theme_config.


theme_config_updated (key: String, old_value: Variant, new_value: Variant)

Emitted when a config value of the theme has been updated. key is the same value used on get_theme_config/set_theme_config, and therefore defined by your theme. old_value and new_value represent the old and new values of that config.


game_data_updated (game_data: RetroHubGameData)

Emitted when a game data has been updated by the user. The reference doesn’t change from the earlier data received from game_received, so you can use it to test whether you need to update displayed information in your theme.

connect("game_data_updated", self, "_on_game_data_updated")

func _on_game_data_updated(game_data):
        if self.game_data == game_data:
                # Update displayed information with new info
                ...

Methods

Type

Name

Variant

get_theme_config

void

set_theme_config

void

save_theme_config


Variant get_theme_config (key: String, default_value: Variant)

Get a theme config under the given key. If the key doesn’t exist, default_value is returned.

Warning

If the key doesn’t exist, default_value is not implicitely set in the configuration.


void set_theme_config (key: String, value: Variant)

Sets a theme config under the given key to value. If the key doesn’t exist, it is created.

Warning

RetroHub only emits the theme_config_updated signal when the settings are saved with save_theme_config.


void save_theme_config ()

Saves the theme config to disk. For every key that has been changed, the theme_config_updated signal is emitted.

Note

If you’re using a dedicated theme config scene, RetroHub will automatically call this function by you when the theme is unloaded, and therefore you only need to use set_theme_config.