Welcome to the forums @msnawe!
@msnawe said:
I can not draw on the texture from the initial callback context following the press event. I can only draw from the _draw function.
Yeah, unfortunately you can only draw to a CanvasItem node in the _draw function. You will need to call the update() function in your callback to trigger the _draw function being called, and then make the adjustments there.
when I move code from the callback to the draw function, I have to resort to variables to condition whether to draw or not in draw. is it how we are supposed to do this in Godot?
If it works, then I would not worry too much about it. That is how I would handle it, and if it becomes an issue later down the road, you can always refactor. I always try to get something working first, and then make it pretty and/or optimize through refactoring later once needed. I find it can be easy to fall into unnecessary premature optimization otherwise.
I can not get a timer timeout to work. The function just continues without waiting for the timeout signal.
I've never really used timers or gotten them to work myself. I'm sure there is a way though, and hopefully someone who knows how they work can chime in!
The only thing I can think of that might be causing the issue is that the wait time, s is too long that it seems like nothing is happening, but given you are printing the time, I do not think this is the issue. Maybe the one-shot part is causing the issue? I would perhaps try using code like this and see if it works:
func wait (s):
print('wait ' + str(s))
t.set_wait_time(s)
t.start()
yield(t, "timeout")
t.stop()
print('timeout ' + str(s))
Also:
This discussion was caught in the moderation queue since you have not confirmed your account yet.
Upon creating your account you should have received an account verification email. The confirmation email may have been incorrectly flagged as spam, so please also check your spam filter. Without confirming your account, future posts may also be caught in the moderation queue. You can resend a confirmation email when you log into your account if you cannot find the first verification email.
If you need any help, please let us know! Thanks! :smile: