Open geekrelief opened 3 years ago
So we can handle signals with an {.async.} proc like this:
... import asynchdispatch gdobj SpriteComp of Sprite: signal bsclick(button_idx:int, shape_idx:int) method ready() = ... registerFrameCallback( proc() = if hasPendingOperations(): poll(0) ) asyncCheck self.fireTimer() self.emit_signal("bsclick", 1.toVariant, 0.toVariant) proc fireTimer() {.async.} = await on_signal(self.get_tree().createTimer(1), "timeout") print "timeout sceneTree" var vals = await on_signal(self, "bsclick", tuple[button_idx:int, shape_idx:int]) print &"bsclick {vals.button_idx = } {vals.shape_idx = }"
Do signals work with either camelCase or snake_case? Or does it only work with snake_case?
So we can handle signals with an {.async.} proc like this: