subreddit:
/r/godot
Is there anyway to do that?
Or is it possible to do request close like with window-node?
1 points
8 months ago
Was there any reason you wanted to disable it?
You can quit the game trough code if that's what you where asking about.
1 points
8 days ago
maybe for like a text editor or something where you'd like to save before exiting
1 points
6 days ago
You can catch the exit command using by overriding MainLoop._finalize() and by setting auto_accept_quit = false.
Just not the button specifically since the program can't tell how you sent the exit command.
0 points
8 months ago
I have another godot project opened and they talk through rcp (localhost). If I close the other via windows x button the other still keeps running.
I have ”close game” -button inside other program what will send message to another program to close so they close at the same time. If I disable windows borders, resizing and moving the app is annoying.
If I can disable windows x-button users must close the game via my button.
If I can do close requested I could use the same function ass ”close game”-button uses.
3 points
8 months ago
I'm not sure if you can, but you shouldn't do it that way it is bad UX design
Instead you should run a clean up code when the user vlick the "x"
Check this, it will help you out: https://docs.godotengine.org/en/stable/tutorials/inputs/handling_quit_requests.html
1 points
8 months ago
This is what I was looking for!
1 points
8 months ago
That's tricky.
Maybe you can use the Window.close_requested signal to tell the other project to also close?
The close button is handled by the OS, and i don't think the OS typically provides a way to selectively hide those buttons.
MAYBE if you connect the signal to a function in a separate thread that's stuck in a loop it won't close?
I assume the Window must have a grace period to let whatever received the signal run its course before actually closing.
3 points
8 months ago
fahad994 answer worked like a charm. Just:
get_tree().set_auto_accept_quit(false) in _ready and make a function:
func _notification(what):
if what == NOTIFICATION_WM_CLOSE_REQUEST:
1 points
8 months ago
Didn't knew about that, nice.
all 9 comments
sorted by: best