summaryrefslogtreecommitdiff
path: root/hello_signals/demo/Main.gd
diff options
context:
space:
mode:
Diffstat (limited to 'hello_signals/demo/Main.gd')
-rw-r--r--hello_signals/demo/Main.gd14
1 files changed, 6 insertions, 8 deletions
diff --git a/hello_signals/demo/Main.gd b/hello_signals/demo/Main.gd
index 1b3e972..2dca0db 100644
--- a/hello_signals/demo/Main.gd
+++ b/hello_signals/demo/Main.gd
@@ -2,16 +2,13 @@ extends Node2D
var timerCount = 0
var timerRunning = false
-var helloSignals
+var helloSignalsPlugin : HelloSignalsPlugin
func _ready():
- if Engine.has_singleton("HelloSignals"):
- helloSignals = Engine.get_singleton("HelloSignals")
- helloSignals.connect("TikTok", Callable(self, "_on_tiktok"))
+ helloSignalsPlugin = preload("res://addons/hello_signals_plugin/interface/hello_signals_plugin.gd").new()
+ helloSignalsPlugin.registerForTikTok(Callable(self, "_on_tiktok"))
- $Button.connect("pressed", Callable(self, "_on_Button_pressed"))
- else:
- print("Couldn't find HelloSignals singleton")
+ $Button.connect("pressed", Callable(self, "_on_Button_pressed"))
func _on_tiktok():
@@ -19,9 +16,10 @@ func _on_tiktok():
timerCount = timerCount + 1
$Label.text = str(timerCount)
+
func _on_Button_pressed():
print("on button pressed from GDScript")
- helloSignals.onButtonPressed()
+ helloSignalsPlugin.toggleTikTok()
timerRunning = !timerRunning
if (timerRunning):
$Button.text = "Stop Timer"