Améliorationdes fenetres et fix du plugin de fenetre qui repetait mal les texture a cause du filtre manquant sur la texture créer par le script.
This commit is contained in:
parent
d6a355142a
commit
d573beff97
6 changed files with 125 additions and 74 deletions
|
@ -5,11 +5,22 @@ export(bool) var is_resizable = true
|
||||||
export(bool) var is_borderless = false
|
export(bool) var is_borderless = false
|
||||||
export(String) var title = "Window"
|
export(String) var title = "Window"
|
||||||
export(Color) var background_color = Color( 1.0, 1.0, 1.0, 1.0 )
|
export(Color) var background_color = Color( 1.0, 1.0, 1.0, 1.0 )
|
||||||
|
|
||||||
|
export(String) var background_texture = "res://assets/GUI/images/background_test.png"
|
||||||
|
|
||||||
|
signal window_clicked( window )
|
||||||
|
|
||||||
var current_rect_size = Vector2( 0, 0 )
|
var current_rect_size = Vector2( 0, 0 )
|
||||||
var current_rect_position = Vector2( -1, -1 )
|
var current_rect_position = Vector2( -1, -1 )
|
||||||
var is_resizing = false
|
var is_resizing = false
|
||||||
var is_moving = false
|
var is_moving = false
|
||||||
|
|
||||||
|
func set_mouse_pass_to_children( node ):
|
||||||
|
for child in node.get_children():
|
||||||
|
set_mouse_pass_to_children( child )
|
||||||
|
if node is Control:
|
||||||
|
node.mouse_filter = MOUSE_FILTER_PASS
|
||||||
|
|
||||||
#func _ready():
|
#func _ready():
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
###
|
###
|
||||||
|
@ -21,6 +32,9 @@ func _enter_tree():
|
||||||
self.set( "custom_constants/margin_top", 0)
|
self.set( "custom_constants/margin_top", 0)
|
||||||
self.set( "custom_constants/margin_left", 0)
|
self.set( "custom_constants/margin_left", 0)
|
||||||
self.set( "custom_constants/margin_bottom", 0)
|
self.set( "custom_constants/margin_bottom", 0)
|
||||||
|
|
||||||
|
|
||||||
|
self.connect ( "gui_input", self, "_on_window_gui_input" )
|
||||||
###
|
###
|
||||||
###
|
###
|
||||||
# Background
|
# Background
|
||||||
|
@ -29,22 +43,24 @@ func _enter_tree():
|
||||||
background = NinePatchRect.new()
|
background = NinePatchRect.new()
|
||||||
background.name = "Background"
|
background.name = "Background"
|
||||||
var background_image = Image.new()
|
var background_image = Image.new()
|
||||||
if not background_image.load( "res://assets/GUI/images/bg2.jpg" ):
|
if not background_image.load( background_texture ):
|
||||||
print("Erreur lors du chargement de l'image: res://assets/GUI/images/bg2.jpg" )
|
print("Erreur lors du chargement de l'image: "+background_texture )
|
||||||
background.texture = ImageTexture.new()
|
background.texture = ImageTexture.new()
|
||||||
background.texture.create_from_image( background_image )
|
background.texture.create_from_image( background_image )
|
||||||
|
background.texture.flags = Texture.FLAG_FILTER | Texture.FLAG_REPEAT
|
||||||
background.axis_stretch_horizontal = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
background.axis_stretch_horizontal = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
||||||
background.axis_stretch_vertical = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
background.axis_stretch_vertical = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
||||||
|
|
||||||
background.size_flags_horizontal = SIZE_EXPAND_FILL
|
background.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||||
background.size_flags_vertical = SIZE_EXPAND_FILL
|
background.size_flags_vertical = SIZE_EXPAND_FILL
|
||||||
|
|
||||||
background.region_rect = Rect2( 0, 0, 0, 0 )
|
# background.rect_clip_content = true
|
||||||
|
|
||||||
|
# background.region_rect = Rect2( 0, 0, 0, 0 )
|
||||||
background.patch_margin_left = 4
|
background.patch_margin_left = 4
|
||||||
background.patch_margin_top = 32
|
background.patch_margin_top = 32
|
||||||
background.patch_margin_right = 4
|
background.patch_margin_right = 4
|
||||||
background.patch_margin_bottom = 3
|
background.patch_margin_bottom = 4
|
||||||
|
|
||||||
background.self_modulate = background_color
|
background.self_modulate = background_color
|
||||||
|
|
||||||
|
@ -67,7 +83,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
# Header
|
# Header
|
||||||
var header
|
var header
|
||||||
if not self.has_node( "Header" ):
|
if not v_box_container.has_node( "Header" ):
|
||||||
header = MarginContainer.new()
|
header = MarginContainer.new()
|
||||||
header.name = "Header"
|
header.name = "Header"
|
||||||
header.size_flags_horizontal = SIZE_EXPAND_FILL
|
header.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||||
|
@ -87,7 +103,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
var header_box
|
var header_box
|
||||||
# Header/HBoxContainer
|
# Header/HBoxContainer
|
||||||
if not self.has_node( "HBoxContainer" ):
|
if not header.has_node( "HBoxContainer" ):
|
||||||
header_box = HBoxContainer.new()
|
header_box = HBoxContainer.new()
|
||||||
header_box.name = "HBoxContainer"
|
header_box.name = "HBoxContainer"
|
||||||
header_box.size_flags_horizontal = SIZE_EXPAND_FILL
|
header_box.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||||
|
@ -100,7 +116,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
# Quit
|
# Quit
|
||||||
var quit_button
|
var quit_button
|
||||||
if not self.has_node( "Quit" ):
|
if not header_box.has_node( "Quit" ):
|
||||||
quit_button = TextureButton.new()
|
quit_button = TextureButton.new()
|
||||||
quit_button.name = "Quit"
|
quit_button.name = "Quit"
|
||||||
quit_button.size_flags_horizontal = SIZE_SHRINK_END
|
quit_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||||
|
@ -118,7 +134,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
# Close
|
# Close
|
||||||
var close_button = TextureButton.new()
|
var close_button = TextureButton.new()
|
||||||
if not self.has_node( "Close" ):
|
if not header_box.has_node( "Close" ):
|
||||||
close_button = TextureButton.new()
|
close_button = TextureButton.new()
|
||||||
close_button.name = "Close"
|
close_button.name = "Close"
|
||||||
close_button.size_flags_horizontal = SIZE_SHRINK_END
|
close_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||||
|
@ -136,7 +152,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
# Open
|
# Open
|
||||||
var open_button
|
var open_button
|
||||||
if not self.has_node( "Open" ):
|
if not header_box.has_node( "Open" ):
|
||||||
open_button = TextureButton.new()
|
open_button = TextureButton.new()
|
||||||
open_button.name = "Open"
|
open_button.name = "Open"
|
||||||
open_button.size_flags_horizontal = SIZE_SHRINK_END
|
open_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||||
|
@ -155,7 +171,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
# Title Label
|
# Title Label
|
||||||
var title_label
|
var title_label
|
||||||
if not self.has_node( "Label" ):
|
if not header_box.has_node( "Label" ):
|
||||||
title_label = Label.new()
|
title_label = Label.new()
|
||||||
title_label.name = "Label"
|
title_label.name = "Label"
|
||||||
title_label.text = title
|
title_label.text = title
|
||||||
|
@ -169,7 +185,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
# Content
|
# Content
|
||||||
var content
|
var content
|
||||||
if not self.has_node( "Content" ):
|
if not v_box_container.has_node( "Content" ):
|
||||||
content = MarginContainer.new()
|
content = MarginContainer.new()
|
||||||
content.name = "Content"
|
content.name = "Content"
|
||||||
content.size_flags_horizontal = SIZE_EXPAND_FILL
|
content.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||||
|
@ -184,7 +200,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
# Footer
|
# Footer
|
||||||
var footer
|
var footer
|
||||||
if not self.has_node( "Footer" ):
|
if not v_box_container.has_node( "Footer" ):
|
||||||
footer = MarginContainer.new()
|
footer = MarginContainer.new()
|
||||||
footer.name = "Footer"
|
footer.name = "Footer"
|
||||||
footer.size_flags_horizontal = SIZE_FILL
|
footer.size_flags_horizontal = SIZE_FILL
|
||||||
|
@ -199,7 +215,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
# Header/HBoxContainer
|
# Header/HBoxContainer
|
||||||
var footer_box
|
var footer_box
|
||||||
if not self.has_node( "HBoxContainer" ):
|
if not footer.has_node( "HBoxContainer" ):
|
||||||
footer_box = HBoxContainer.new()
|
footer_box = HBoxContainer.new()
|
||||||
footer_box.name = "HBoxContainer"
|
footer_box.name = "HBoxContainer"
|
||||||
footer_box.size_flags_horizontal = SIZE_FILL
|
footer_box.size_flags_horizontal = SIZE_FILL
|
||||||
|
@ -210,7 +226,7 @@ func _enter_tree():
|
||||||
###
|
###
|
||||||
# Open
|
# Open
|
||||||
var resize_button
|
var resize_button
|
||||||
if not self.has_node( "Resize" ):
|
if not footer_box.has_node( "Resize" ):
|
||||||
resize_button = TextureButton.new()
|
resize_button = TextureButton.new()
|
||||||
resize_button.name = "Resize"
|
resize_button.name = "Resize"
|
||||||
resize_button.size_flags_horizontal = SIZE_EXPAND | SIZE_SHRINK_END
|
resize_button.size_flags_horizontal = SIZE_EXPAND | SIZE_SHRINK_END
|
||||||
|
@ -245,6 +261,8 @@ func _enter_tree():
|
||||||
if not is_resizable:
|
if not is_resizable:
|
||||||
$VBoxContainer/Footer/HBoxContainer/Resize.visible = false
|
$VBoxContainer/Footer/HBoxContainer/Resize.visible = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
set_mouse_pass_to_children( self )
|
||||||
|
|
||||||
func _on_Window_mouse_entered():
|
func _on_Window_mouse_entered():
|
||||||
print("mouse_entered")
|
print("mouse_entered")
|
||||||
|
@ -309,16 +327,34 @@ func _input( event ):
|
||||||
if event is InputEventMouseMotion and is_resizing:
|
if event is InputEventMouseMotion and is_resizing:
|
||||||
var delta = event.relative
|
var delta = event.relative
|
||||||
self.rect_size += delta
|
self.rect_size += delta
|
||||||
|
#
|
||||||
|
# var mouse_position = get_viewport().get_mouse_position()
|
||||||
|
# var size_modulo = Vector2( int(self.rect_size.x) % 2, int(self.rect_size.y) % 2 )
|
||||||
|
# self.rect_size -= size_modulo
|
||||||
|
# get_viewport().warp_mouse( mouse_position - size_modulo )
|
||||||
|
|
||||||
|
|
||||||
|
func check_if_clicked( event ):
|
||||||
|
if not is_moving and event is InputEventMouseButton and event.is_pressed() and not event.is_echo() and event.button_index == 1 :
|
||||||
|
emit_signal( "window_clicked", self )
|
||||||
|
|
||||||
|
func _on_Header_gui_input( event ):
|
||||||
|
|
||||||
|
check_if_clicked( event )
|
||||||
|
|
||||||
func _on_Header_gui_input(ev):
|
|
||||||
if is_movable:
|
if is_movable:
|
||||||
if is_moving and ev is InputEventMouseButton and not ev.pressed:
|
if is_moving and event is InputEventMouseButton and not event.pressed:
|
||||||
is_moving = false
|
is_moving = false
|
||||||
elif not is_moving and ev is InputEventMouseButton and ev.pressed:
|
elif not is_moving and event is InputEventMouseButton and event.pressed:
|
||||||
is_moving = true
|
is_moving = true
|
||||||
if ev is InputEventMouseMotion and is_moving:
|
if event is InputEventMouseMotion and is_moving:
|
||||||
var delta = ev.relative
|
var delta = event.relative
|
||||||
self.rect_position += delta
|
self.rect_position += delta
|
||||||
|
# self.rect_position -= Vector2( int(self.rect_size.x) % 2, int(self.rect_size.y) % 2 )
|
||||||
|
# get_viewport().warp_mouse( get_viewport().get_mouse_position() - Vector2( int(get_viewport().get_mouse_position().x) % 2, int(get_viewport().get_mouse_position().y) % 2 ) )
|
||||||
|
|
||||||
|
func _on_window_gui_input( event ):
|
||||||
|
check_if_clicked( event )
|
||||||
|
|
||||||
func load_from_file( config_file ):
|
func load_from_file( config_file ):
|
||||||
if config_file.has_section( self.name ):
|
if config_file.has_section( self.name ):
|
||||||
|
|
BIN
assets/GUI/images/background_test.jpg
Normal file
BIN
assets/GUI/images/background_test.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
BIN
assets/GUI/images/background_test.png
Normal file
BIN
assets/GUI/images/background_test.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
|
@ -91,9 +91,9 @@ anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 237.0
|
margin_left = 238.0
|
||||||
margin_top = 15.0
|
margin_top = 15.0
|
||||||
margin_right = 526.0
|
margin_right = 527.0
|
||||||
margin_bottom = 143.0
|
margin_bottom = 143.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
|
@ -136,10 +136,11 @@ patch_margin_right = 4
|
||||||
patch_margin_bottom = 4
|
patch_margin_bottom = 4
|
||||||
axis_stretch_horizontal = 1
|
axis_stretch_horizontal = 1
|
||||||
axis_stretch_vertical = 1
|
axis_stretch_vertical = 1
|
||||||
_sections_unfolded = [ "Axis Stretch", "Material", "Mouse", "Patch Margin", "Rect", "Size Flags", "Theme", "Visibility" ]
|
_sections_unfolded = [ "Axis Stretch", "Grow Direction", "Material", "Mouse", "Patch Margin", "Rect", "Size Flags", "Theme", "Visibility" ]
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="Windows/Test" index="1"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="Windows/Test" index="1"]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -158,6 +159,7 @@ _sections_unfolded = [ "Mouse", "Rect", "Size Flags", "Visibility", "custom_cons
|
||||||
|
|
||||||
[node name="Header" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="0"]
|
[node name="Header" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="0"]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -178,6 +180,7 @@ _sections_unfolded = [ "Margin", "Mouse", "Rect", "Size Flags", "custom_constant
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="Windows/Test/VBoxContainer/Header" index="0"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="Windows/Test/VBoxContainer/Header" index="0"]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -288,7 +291,6 @@ _sections_unfolded = [ "Hint", "Mouse", "Size Flags" ]
|
||||||
|
|
||||||
[node name="Content" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="1"]
|
[node name="Content" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="1"]
|
||||||
|
|
||||||
editor/display_folded = true
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -298,7 +300,7 @@ margin_right = 289.0
|
||||||
margin_bottom = 104.0
|
margin_bottom = 104.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
@ -306,7 +308,7 @@ custom_constants/margin_right = 8
|
||||||
custom_constants/margin_top = 8
|
custom_constants/margin_top = 8
|
||||||
custom_constants/margin_left = 8
|
custom_constants/margin_left = 8
|
||||||
custom_constants/margin_bottom = 8
|
custom_constants/margin_bottom = 8
|
||||||
_sections_unfolded = [ "Rect", "Size Flags", "custom_constants" ]
|
_sections_unfolded = [ "Mouse", "Rect", "Size Flags", "custom_constants" ]
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="Windows/Test/VBoxContainer/Content" index="0"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="Windows/Test/VBoxContainer/Content" index="0"]
|
||||||
|
|
||||||
|
@ -321,7 +323,7 @@ margin_bottom = 72.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = true
|
rect_clip_content = true
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
mouse_filter = 0
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
|
@ -336,10 +338,11 @@ scroll_active = true
|
||||||
scroll_following = true
|
scroll_following = true
|
||||||
selection_enabled = true
|
selection_enabled = true
|
||||||
override_selected_font_color = false
|
override_selected_font_color = false
|
||||||
_sections_unfolded = [ "BBCode", "Rect", "Size Flags" ]
|
_sections_unfolded = [ "BBCode", "Mouse", "Rect", "Size Flags" ]
|
||||||
|
|
||||||
[node name="Footer" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="2"]
|
[node name="Footer" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="2"]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -404,15 +407,14 @@ _sections_unfolded = [ "Mouse", "Size Flags", "Textures" ]
|
||||||
|
|
||||||
[node name="TestBorderless" type="MarginContainer" parent="Windows" index="1"]
|
[node name="TestBorderless" type="MarginContainer" parent="Windows" index="1"]
|
||||||
|
|
||||||
editor/display_folded = true
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 266.0
|
margin_left = 266.0
|
||||||
margin_top = 154.0
|
margin_top = 153.0
|
||||||
margin_right = 513.0
|
margin_right = 513.0
|
||||||
margin_bottom = 341.0
|
margin_bottom = 340.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
hint_tooltip = "Tooltips test."
|
hint_tooltip = "Tooltips test."
|
||||||
|
@ -452,12 +454,13 @@ patch_margin_left = 4
|
||||||
patch_margin_top = 32
|
patch_margin_top = 32
|
||||||
patch_margin_right = 4
|
patch_margin_right = 4
|
||||||
patch_margin_bottom = 4
|
patch_margin_bottom = 4
|
||||||
axis_stretch_horizontal = 1
|
axis_stretch_horizontal = 2
|
||||||
axis_stretch_vertical = 1
|
axis_stretch_vertical = 2
|
||||||
_sections_unfolded = [ "Axis Stretch", "Material", "Patch Margin", "Rect", "Size Flags", "Theme", "Visibility" ]
|
_sections_unfolded = [ "Axis Stretch", "Material", "Patch Margin", "Rect", "Size Flags", "Theme", "Visibility" ]
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="Windows/TestBorderless" index="1"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="Windows/TestBorderless" index="1"]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -472,10 +475,11 @@ size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
custom_constants/separation = 0
|
custom_constants/separation = 0
|
||||||
alignment = 0
|
alignment = 0
|
||||||
_sections_unfolded = [ "Rect", "Size Flags", "Visibility", "custom_constants" ]
|
_sections_unfolded = [ "Mouse", "Rect", "Size Flags", "Visibility", "custom_constants" ]
|
||||||
|
|
||||||
[node name="Header" type="MarginContainer" parent="Windows/TestBorderless/VBoxContainer" index="0"]
|
[node name="Header" type="MarginContainer" parent="Windows/TestBorderless/VBoxContainer" index="0"]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -484,7 +488,7 @@ margin_right = 247.0
|
||||||
margin_bottom = 24.0
|
margin_bottom = 24.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 13
|
mouse_default_cursor_shape = 13
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
|
@ -496,6 +500,7 @@ _sections_unfolded = [ "Mouse", "Rect", "Size Flags", "custom_constants" ]
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="Windows/TestBorderless/VBoxContainer/Header" index="0"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="Windows/TestBorderless/VBoxContainer/Header" index="0"]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -606,7 +611,6 @@ _sections_unfolded = [ "Hint", "Mouse", "Size Flags" ]
|
||||||
|
|
||||||
[node name="Content" type="MarginContainer" parent="Windows/TestBorderless/VBoxContainer" index="1"]
|
[node name="Content" type="MarginContainer" parent="Windows/TestBorderless/VBoxContainer" index="1"]
|
||||||
|
|
||||||
editor/display_folded = true
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -616,7 +620,7 @@ margin_right = 247.0
|
||||||
margin_bottom = 163.0
|
margin_bottom = 163.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
@ -624,7 +628,7 @@ custom_constants/margin_right = 8
|
||||||
custom_constants/margin_top = 8
|
custom_constants/margin_top = 8
|
||||||
custom_constants/margin_left = 8
|
custom_constants/margin_left = 8
|
||||||
custom_constants/margin_bottom = 8
|
custom_constants/margin_bottom = 8
|
||||||
_sections_unfolded = [ "Rect", "Size Flags", "custom_constants" ]
|
_sections_unfolded = [ "Mouse", "Rect", "Size Flags", "custom_constants" ]
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="Windows/TestBorderless/VBoxContainer/Content" index="0"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="Windows/TestBorderless/VBoxContainer/Content" index="0"]
|
||||||
|
|
||||||
|
@ -643,6 +647,7 @@ mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
alignment = 0
|
alignment = 0
|
||||||
|
_sections_unfolded = [ "Mouse" ]
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="Windows/TestBorderless/VBoxContainer/Content/VBoxContainer" index="0"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="Windows/TestBorderless/VBoxContainer/Content/VBoxContainer" index="0"]
|
||||||
|
|
||||||
|
@ -655,7 +660,7 @@ margin_bottom = 59.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = true
|
rect_clip_content = true
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
mouse_filter = 0
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
@ -670,7 +675,7 @@ scroll_active = true
|
||||||
scroll_following = true
|
scroll_following = true
|
||||||
selection_enabled = true
|
selection_enabled = true
|
||||||
override_selected_font_color = false
|
override_selected_font_color = false
|
||||||
_sections_unfolded = [ "BBCode", "Focus", "Rect", "Size Flags" ]
|
_sections_unfolded = [ "BBCode", "Focus", "Mouse", "Rect", "Size Flags" ]
|
||||||
|
|
||||||
[node name="RichTextLabel2" type="RichTextLabel" parent="Windows/TestBorderless/VBoxContainer/Content/VBoxContainer" index="1"]
|
[node name="RichTextLabel2" type="RichTextLabel" parent="Windows/TestBorderless/VBoxContainer/Content/VBoxContainer" index="1"]
|
||||||
|
|
||||||
|
@ -684,7 +689,7 @@ margin_bottom = 123.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = true
|
rect_clip_content = true
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
mouse_filter = 0
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 5
|
size_flags_horizontal = 5
|
||||||
size_flags_vertical = 11
|
size_flags_vertical = 11
|
||||||
|
@ -699,7 +704,7 @@ scroll_active = true
|
||||||
scroll_following = true
|
scroll_following = true
|
||||||
selection_enabled = true
|
selection_enabled = true
|
||||||
override_selected_font_color = false
|
override_selected_font_color = false
|
||||||
_sections_unfolded = [ "BBCode", "Focus", "Rect", "Size Flags" ]
|
_sections_unfolded = [ "BBCode", "Focus", "Mouse", "Rect", "Size Flags" ]
|
||||||
|
|
||||||
[node name="Footer" type="MarginContainer" parent="Windows/TestBorderless/VBoxContainer" index="2"]
|
[node name="Footer" type="MarginContainer" parent="Windows/TestBorderless/VBoxContainer" index="2"]
|
||||||
|
|
||||||
|
@ -739,6 +744,7 @@ mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
alignment = 0
|
alignment = 0
|
||||||
|
_sections_unfolded = [ "Mouse" ]
|
||||||
|
|
||||||
[node name="Resize" type="TextureButton" parent="Windows/TestBorderless/VBoxContainer/Footer/HBoxContainer" index="0"]
|
[node name="Resize" type="TextureButton" parent="Windows/TestBorderless/VBoxContainer/Footer/HBoxContainer" index="0"]
|
||||||
|
|
||||||
|
@ -752,7 +758,7 @@ margin_bottom = 16.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
mouse_filter = 0
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 12
|
mouse_default_cursor_shape = 12
|
||||||
size_flags_horizontal = 10
|
size_flags_horizontal = 10
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
|
@ -766,6 +772,7 @@ _sections_unfolded = [ "Mouse", "Size Flags", "Textures" ]
|
||||||
|
|
||||||
[node name="Music" type="MarginContainer" parent="Windows" index="2"]
|
[node name="Music" type="MarginContainer" parent="Windows" index="2"]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -979,7 +986,7 @@ margin_right = 129.0
|
||||||
margin_bottom = 106.0
|
margin_bottom = 106.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
@ -987,7 +994,7 @@ custom_constants/margin_right = 8
|
||||||
custom_constants/margin_top = 8
|
custom_constants/margin_top = 8
|
||||||
custom_constants/margin_left = 8
|
custom_constants/margin_left = 8
|
||||||
custom_constants/margin_bottom = 8
|
custom_constants/margin_bottom = 8
|
||||||
_sections_unfolded = [ "Rect", "Size Flags", "custom_constants" ]
|
_sections_unfolded = [ "Mouse", "Rect", "Size Flags", "custom_constants" ]
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="Windows/Music/VBoxContainer/Content" index="0"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="Windows/Music/VBoxContainer/Content" index="0"]
|
||||||
|
|
||||||
|
@ -1003,7 +1010,7 @@ margin_bottom = 74.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = true
|
rect_clip_content = true
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
mouse_filter = 0
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
|
@ -1108,14 +1115,16 @@ mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
script = ExtResource( 10 )
|
script = ExtResource( 10 )
|
||||||
|
_sections_unfolded = [ "custom_constants" ]
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_editor_icon": ExtResource( 11 )
|
"_editor_icon": ExtResource( 11 )
|
||||||
}
|
}
|
||||||
is_movable = true
|
is_movable = true
|
||||||
is_resizable = true
|
is_resizable = true
|
||||||
is_borderless = false
|
is_borderless = false
|
||||||
title = "Window test"
|
title = "Test window plugin"
|
||||||
background_color = Color( 0.808594, 0.808594, 0.808594, 1 )
|
background_color = Color( 0.808594, 0.808594, 0.808594, 1 )
|
||||||
|
background_texture = "res://assets/GUI/images/background_test.png"
|
||||||
|
|
||||||
[node name="Music" parent="." index="3" instance=ExtResource( 9 )]
|
[node name="Music" parent="." index="3" instance=ExtResource( 9 )]
|
||||||
|
|
||||||
|
@ -1368,6 +1377,8 @@ flat = false
|
||||||
align = 1
|
align = 1
|
||||||
_sections_unfolded = [ "Size Flags" ]
|
_sections_unfolded = [ "Size Flags" ]
|
||||||
|
|
||||||
|
[connection signal="gui_input" from="Windows/Test" to="Windows/Test" method="_on_window_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"]
|
||||||
|
@ -1378,6 +1389,8 @@ _sections_unfolded = [ "Size Flags" ]
|
||||||
|
|
||||||
[connection signal="pressed" from="Windows/Test/VBoxContainer/Footer/HBoxContainer/Resize" to="Windows/Test" method="_on_Resize_pressed"]
|
[connection signal="pressed" from="Windows/Test/VBoxContainer/Footer/HBoxContainer/Resize" to="Windows/Test" method="_on_Resize_pressed"]
|
||||||
|
|
||||||
|
[connection signal="gui_input" from="Windows/TestBorderless" to="Windows/TestBorderless" method="_on_window_gui_input"]
|
||||||
|
|
||||||
[connection signal="gui_input" from="Windows/TestBorderless/VBoxContainer/Header" to="Windows/TestBorderless" method="_on_Header_gui_input"]
|
[connection signal="gui_input" from="Windows/TestBorderless/VBoxContainer/Header" to="Windows/TestBorderless" method="_on_Header_gui_input"]
|
||||||
|
|
||||||
[connection signal="pressed" from="Windows/TestBorderless/VBoxContainer/Header/HBoxContainer/Quit" to="Windows/TestBorderless" method="_on_Quit_pressed"]
|
[connection signal="pressed" from="Windows/TestBorderless/VBoxContainer/Header/HBoxContainer/Quit" to="Windows/TestBorderless" method="_on_Quit_pressed"]
|
||||||
|
@ -1386,8 +1399,12 @@ _sections_unfolded = [ "Size Flags" ]
|
||||||
|
|
||||||
[connection signal="pressed" from="Windows/TestBorderless/VBoxContainer/Header/HBoxContainer/Open" to="Windows/TestBorderless" method="_on_Open_pressed"]
|
[connection signal="pressed" from="Windows/TestBorderless/VBoxContainer/Header/HBoxContainer/Open" to="Windows/TestBorderless" method="_on_Open_pressed"]
|
||||||
|
|
||||||
|
[connection signal="gui_input" from="Windows/TestBorderless/VBoxContainer/Footer" to="Windows/TestBorderless" method="_on_footer_gui_input"]
|
||||||
|
|
||||||
[connection signal="pressed" from="Windows/TestBorderless/VBoxContainer/Footer/HBoxContainer/Resize" to="Windows/TestBorderless" method="_on_Resize_pressed"]
|
[connection signal="pressed" from="Windows/TestBorderless/VBoxContainer/Footer/HBoxContainer/Resize" to="Windows/TestBorderless" method="_on_Resize_pressed"]
|
||||||
|
|
||||||
|
[connection signal="gui_input" from="Windows/Music" to="Windows/Music" method="_on_window_gui_input"]
|
||||||
|
|
||||||
[connection signal="gui_input" from="Windows/Music/VBoxContainer/Header" to="Windows/Music" method="_on_Header_gui_input"]
|
[connection signal="gui_input" from="Windows/Music/VBoxContainer/Header" to="Windows/Music" method="_on_Header_gui_input"]
|
||||||
|
|
||||||
[connection signal="pressed" from="Windows/Music/VBoxContainer/Header/HBoxContainer/Quit" to="Windows/Music" method="_on_Quit_pressed"]
|
[connection signal="pressed" from="Windows/Music/VBoxContainer/Header/HBoxContainer/Quit" to="Windows/Music" method="_on_Quit_pressed"]
|
||||||
|
|
|
@ -11,6 +11,12 @@ var current_rect_position = Vector2( -1, -1 )
|
||||||
var is_resizing = false
|
var is_resizing = false
|
||||||
var is_moving = false
|
var is_moving = false
|
||||||
|
|
||||||
|
func set_mouse_pass_to_children( node ):
|
||||||
|
for child in node.get_children():
|
||||||
|
set_mouse_pass_to_children( child )
|
||||||
|
if node is Control:
|
||||||
|
node.mouse_filter = MOUSE_FILTER_PASS
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
current_rect_size = self.rect_min_size
|
current_rect_size = self.rect_min_size
|
||||||
|
|
||||||
|
@ -29,6 +35,9 @@ func _ready():
|
||||||
if not is_resizable:
|
if not is_resizable:
|
||||||
$VBoxContainer/Footer/HBoxContainer/Resize.visible = false
|
$VBoxContainer/Footer/HBoxContainer/Resize.visible = false
|
||||||
|
|
||||||
|
set_mouse_pass_to_children( self )
|
||||||
|
|
||||||
|
|
||||||
func _on_Window_mouse_entered():
|
func _on_Window_mouse_entered():
|
||||||
print("mouse_entered")
|
print("mouse_entered")
|
||||||
|
|
||||||
|
@ -86,9 +95,6 @@ func _on_Resize_pressed():
|
||||||
is_resizing = true
|
is_resizing = true
|
||||||
|
|
||||||
func _input( event ):
|
func _input( event ):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if is_resizable:
|
if is_resizable:
|
||||||
if is_resizing and event is InputEventMouseButton and not event.pressed:
|
if is_resizing and event is InputEventMouseButton and not event.pressed:
|
||||||
is_resizing = false
|
is_resizing = false
|
||||||
|
@ -96,11 +102,14 @@ func _input( event ):
|
||||||
var delta = event.relative
|
var delta = event.relative
|
||||||
self.rect_size += delta
|
self.rect_size += delta
|
||||||
|
|
||||||
|
|
||||||
|
func check_if_clicked( event ):
|
||||||
|
if not is_moving and event is InputEventMouseButton and event.is_pressed() and not event.is_echo() and event.button_index == 1 :
|
||||||
|
emit_signal( "window_clicked", self )
|
||||||
|
|
||||||
func _on_Header_gui_input( event ):
|
func _on_Header_gui_input( event ):
|
||||||
|
|
||||||
if not is_moving and event is InputEventMouseButton and event.is_pressed() and not event.is_echo() and event.button_index == 1 :
|
check_if_clicked( event )
|
||||||
put_above_other()
|
|
||||||
|
|
||||||
|
|
||||||
if is_movable:
|
if is_movable:
|
||||||
if is_moving and event is InputEventMouseButton and not event.pressed:
|
if is_moving and event is InputEventMouseButton and not event.pressed:
|
||||||
|
@ -144,22 +153,9 @@ func save_to_file( config_file ):
|
||||||
|
|
||||||
config_file.set_value(self.name, "borderless", is_borderless)
|
config_file.set_value(self.name, "borderless", is_borderless)
|
||||||
|
|
||||||
func put_above_other():
|
func _on_window_gui_input( event ):
|
||||||
# var index = 0
|
check_if_clicked( event )
|
||||||
# for child in get_parent().get_children():
|
|
||||||
# get_parent().move_child(child, index)
|
|
||||||
# index += 1
|
|
||||||
# get_parent().move_child(self, index)
|
|
||||||
|
|
||||||
# var parent = self.get_parent()
|
func _on_footer_gui_input( event ):
|
||||||
# var last_child = parent.get_child( parent.get_child_count()-1 )
|
# check_if_clicked( event )
|
||||||
# if not self.is_greater_than( last_child ):
|
|
||||||
# parent.remove_child( self )
|
|
||||||
# parent.add_child_below_node( last_child, self )
|
|
||||||
|
|
||||||
# self.raise()
|
|
||||||
emit_signal( "window_clicked", self )
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,3 +12,5 @@ func _on_window_clicked( window ):
|
||||||
self.move_child(child, index)
|
self.move_child(child, index)
|
||||||
index += 1
|
index += 1
|
||||||
self.move_child(window, index)
|
self.move_child(window, index)
|
||||||
|
|
||||||
|
# TODO deplacer le deplacement des fenetres ici et tout ce qui est management des fenetre et non de leur contenu.
|
Loading…
Reference in a new issue