fix l'appuis sur echap ne liberait plus la souris

This commit is contained in:
osquallo 2018-07-30 14:56:17 +02:00
parent 7a680e77c1
commit ecc678a1e2
6 changed files with 13 additions and 22 deletions

View file

@ -41,7 +41,7 @@ func _input(event):
play() play()
# ---------------------------------- # ----------------------------------
# Capturing/Freeing the cursor # Capturing/Freeing the cursor
if Input.is_action_just_pressed("ui_free_cursor") and event is InputEventKey: if Input.is_action_just_pressed("ui_free_cursor"):
if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE: if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
else: else:

View file

@ -19,7 +19,7 @@ _sections_unfolded = [ "Font", "Settings" ]
default_font = SubResource( 1 ) default_font = SubResource( 1 )
[node name="GUI" type="MarginContainer"] [node name="GUI" type="MarginContainer" index="0"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0

View file

@ -27,14 +27,3 @@ func _on_SaveHUD_pressed():
child.save_to_file( config_file ) child.save_to_file( config_file )
config_file.save( HUD_config_file ) config_file.save( HUD_config_file )
func _on_Windows_gui_input( event ):
if event is InputEventMouseButton \
and Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE \
and event.is_action_pressed( "ui_free_cursor" ):
Input.set_mouse_mode( Input.MOUSE_MODE_CAPTURED )
elif event is InputEventMouseButton \
and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED \
and event.is_action_pressed( "ui_free_cursor" ):
Input.set_mouse_mode( Input.MOUSE_MODE_VISIBLE )

View file

@ -12,7 +12,7 @@
[ext_resource path="res://scenes/GUI/HUD/trauma.gd" type="Script" id=10] [ext_resource path="res://scenes/GUI/HUD/trauma.gd" type="Script" id=10]
[ext_resource path="res://scenes/GUI/HUD/douleur.gd" type="Script" id=11] [ext_resource path="res://scenes/GUI/HUD/douleur.gd" type="Script" id=11]
[node name="HUD" type="MarginContainer"] [node name="HUD" type="MarginContainer" index="0"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -33,7 +33,6 @@ _sections_unfolded = [ "Margin", "Mouse", "Rect", "Size Flags", "Theme", "Visibi
[node name="overlay_oubli" type="Panel" parent="." index="0"] [node name="overlay_oubli" type="Panel" parent="." index="0"]
visible = false
modulate = Color( 0, 0, 0, 0 ) modulate = Color( 0, 0, 0, 0 )
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -51,7 +50,6 @@ _sections_unfolded = [ "Mouse", "Visibility" ]
[node name="overlay_douleur" type="Panel" parent="." index="1"] [node name="overlay_douleur" type="Panel" parent="." index="1"]
visible = false
modulate = Color( 1, 0, 0, 0 ) modulate = Color( 1, 0, 0, 0 )
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -1338,8 +1336,6 @@ flat = false
align = 1 align = 1
_sections_unfolded = [ "Size Flags" ] _sections_unfolded = [ "Size Flags" ]
[connection signal="gui_input" from="Windows" to="." method="_on_Windows_gui_input"]
[connection signal="gui_input" from="Windows/Test/VBoxContainer/Header" to="Windows/Test" method="_on_Header_gui_input"] [connection signal="gui_input" from="Windows/Test/VBoxContainer/Header" to="Windows/Test" method="_on_Header_gui_input"]
[connection signal="pressed" from="Windows/Test/VBoxContainer/Header/HBoxContainer/Quit" to="Windows/Test" method="_on_Quit_pressed"] [connection signal="pressed" from="Windows/Test/VBoxContainer/Header/HBoxContainer/Quit" to="Windows/Test" method="_on_Quit_pressed"]

View file

@ -6,7 +6,7 @@ export(bool) var is_borderless = false
var current_rect_size = Vector2( 0, 0 ) var current_rect_size = Vector2( 0, 0 )
var current_rect_position = Vector2( 0, 0 ) var current_rect_position = Vector2( -1, -1 )
var is_resizing = false var is_resizing = false
var is_moving = false var is_moving = false
@ -118,10 +118,16 @@ func load_from_file( config_file ):
func save_to_file( config_file ): func save_to_file( config_file ):
config_file.set_value(self.name, "position", self.rect_position) config_file.set_value(self.name, "position", self.rect_position)
if not current_rect_size == Vector2( -1, -1 ):
config_file.set_value(self.name, "size", current_rect_size) config_file.set_value(self.name, "size", current_rect_size)
else:
config_file.set_value(self.name, "size", self.rect_size)
if $VBoxContainer/Content.visible: if $VBoxContainer/Content.visible:
config_file.set_value(self.name, "opened", true) config_file.set_value(self.name, "opened", true)
else: else:
config_file.set_value(self.name, "opened", false) config_file.set_value(self.name, "opened", false)
config_file.set_value(self.name, "borderless", is_borderless) config_file.set_value(self.name, "borderless", is_borderless)

View file

@ -148,7 +148,7 @@ use_filter = false
font_data = ExtResource( 2 ) font_data = ExtResource( 2 )
_sections_unfolded = [ "Font", "Settings" ] _sections_unfolded = [ "Font", "Settings" ]
[node name="Settings" type="MarginContainer" index="0"] [node name="Settings" type="MarginContainer"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0