-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logic.gd
130 lines (110 loc) · 5 KB
/
Logic.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
extends Node
# _ready function, called everytime the theme is loaded, and only once
func _ready():
# App related signals
RetroHub.app_initializing.connect(_on_app_initializing)
RetroHub.app_closing.connect(_on_app_closing)
RetroHub.app_received_focus.connect(_on_app_received_focus)
RetroHub.app_lost_focus.connect(_on_app_lost_focus)
RetroHub.app_returning.connect(_on_app_returning)
# Content related signals
RetroHub.system_receive_start.connect(_on_system_receive_start)
RetroHub.system_received.connect(_on_system_received)
RetroHub.system_receive_end.connect(_on_system_receive_end)
RetroHub.game_receive_start.connect(_on_game_receive_start)
RetroHub.game_received.connect(_on_game_received)
RetroHub.game_receive_end.connect(_on_game_receive_end)
# Config related signals
RetroHubConfig.config_ready.connect(_on_config_ready)
RetroHubConfig.config_updated.connect(_on_config_updated)
RetroHubConfig.theme_config_ready.connect(_on_theme_config_ready)
RetroHubConfig.theme_config_updated.connect(_on_theme_config_updated)
RetroHubConfig.game_data_updated.connect(_on_game_data_updated)
#_unhandled_input, called at every input event
# use this function for input (not _input/_process) for
# proper behavior with RetroHub
func _unhandled_input(event):
pass
## Called when RetroHub is initializing your theme.
## This can either happen when RetroHub is launching, or
## the theme was changed to this one.
func _on_app_initializing():
pass
## Called when RetroHub is unitializing your theme.
## This can either happen when RetroHub is closing, or
## the theme was changed to another one.
##
## While this function can block for the duration needed
## (if, for example, you want to do a custom "exiting" animation),
## do not do anything that takes too long.
func _on_app_closing():
pass
## Called when RetroHub window receives focus without any current game launched.
## Use this for any behavior desired (for example, re-enabling audio streams)
func _on_app_received_focus():
pass
## Called when RetroHub window loses focus without any current game launched.
## Use this for any behavior desired (for example, muting audio streams)
func _on_app_lost_focus():
pass
## Called when RetroHub is returning from a launched game back into focus.
## The way RetroHub works, signals "app_initialized", and all "system_received"
## and "game_received" signals are sent before this signal is fired, as themes
## are unloaded during games to reduce memory footprint. Use this signal to
## recreate the UI state as it was before launching the game.
func _on_app_returning(system_data: RetroHubSystemData, game_data: RetroHubGameData):
pass
## Called when RetroHub is about to send all system data.
func _on_system_receive_start():
pass
## Called when RetroHub has information of a game system available.
## It's entirely up to you how to display that system information.
## RetroHub only sends information from systems with detected games.
##
## System information always arrives before game information.
func _on_system_received(data: RetroHubSystemData):
print("System received: %s [%s]" % [data.fullname, data.name])
## Called when RetroHub has finished sending all system data.
## Game data will follow immediately after this.
func _on_system_receive_end():
pass
## Called when RetroHub is about to send all game data.
## At this point, all system data has been sent to the theme.
func _on_game_receive_start():
pass
## Called when RetroHub has information of a game available.
## It's entirely up to you how to display that game information.
##
## Game information always arrives after system information.
func _on_game_received(data: RetroHubGameData):
print("Game received: %s [%s]" % [data.name, data.system.name])
## Called when RetroHub has finished sending all game data.
func _on_game_receive_end():
pass
## Called when RetroHub's configuration has finished loading.
## Use this to customize your theme appearance according to
## user configuration
func _on_config_ready(config_data: ConfigData):
pass
## Called when some RetroHub config has been changed by the user.
## Check which key is from ConfigData.KEY_(...).
func _on_config_updated(key: String, old_value, new_value):
pass
## Called when the theme's configuration has finished loading.
## Use this to customize your theme appearance according to
## your own custom configuration. Always use
## RetroHubConfig.get_theme_config() / RetroHubConfig.set_theme_config()
## to access your theme configurations. This ensures proper
## behavior when reading/saving settings
func _on_theme_config_ready():
pass
## Called when some theme config has been changed by the user.
func _on_theme_config_updated(key: String, old_value, new_value):
pass
## Called when any game information and/or media has been changed by the
## user. This can happen via automatic scraping or manual edits. The given
## reference is identical to one passed earlier from the "game_received"
## signal, so you can use this to detect which game changed and only update
## that data.
func _on_game_data_updated(data: RetroHubGameData):
pass