Skip to content

Commit

Permalink
Disable quit button for HTML5
Browse files Browse the repository at this point in the history
  • Loading branch information
RailKill committed Aug 22, 2020
1 parent de36a17 commit c33feb6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 5 additions & 3 deletions assets/scripts/ingame_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ onready var button_resume = $VBoxContainer/ButtonResume
var cannot_close = false


func _ready():
if OS.get_name() == "HTML5":
$VBoxContainer/ButtonQuit.set_disabled(true)


func _input(_event):
if Input.is_action_just_pressed("ui_cancel") and not cannot_close:
if visible:
Expand All @@ -28,9 +33,6 @@ func _on_ButtonResume_pressed():

func _on_ButtonQuit_pressed():
get_tree().quit()

if OS.has_feature('JavaScript'):
JavaScript.eval("window.close()")


func _on_ButtonRestart_pressed():
Expand Down
5 changes: 2 additions & 3 deletions assets/scripts/main_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ extends Control

func _ready():
$VBoxContainer/ButtonStart.grab_focus()
if OS.get_name() == "HTML5":
$VBoxContainer/ButtonQuit.set_disabled(true)


func _on_ButtonStart_pressed():
Expand All @@ -21,9 +23,6 @@ func _on_ButtonThird_pressed():

func _on_ButtonQuit_pressed():
get_tree().quit()

if OS.has_feature('JavaScript'):
JavaScript.eval("window.close()")


func _on_ButtonFullscreen_pressed():
Expand Down

0 comments on commit c33feb6

Please sign in to comment.