can resize tool
This commit is contained in:
parent
85740ade1d
commit
4edf4f5024
3 changed files with 42 additions and 3 deletions
25
TitleBar.gd
25
TitleBar.gd
|
|
@ -2,6 +2,7 @@ extends Control
|
|||
|
||||
var following = false
|
||||
var dragging_start_position : Vector2i = Vector2i()
|
||||
@export var options_menu : PopupMenu
|
||||
|
||||
func _on_TitleBar_gui_input(event):
|
||||
if event is InputEventMouseButton:
|
||||
|
|
@ -9,12 +10,18 @@ func _on_TitleBar_gui_input(event):
|
|||
if event.get_button_index() == 1:
|
||||
following = !following
|
||||
dragging_start_position = get_local_mouse_position()
|
||||
if event.get_button_index() == 2:
|
||||
open_menu()
|
||||
|
||||
func _process(_delta):
|
||||
if following:
|
||||
get_window().position = get_window().position + Vector2i(get_global_mouse_position()) - dragging_start_position
|
||||
#OS.set_window_position(OS.window_position + get_global_mouse_position() - dragging_start_position)
|
||||
#if (Input.is_action_just_pressed("ui_up")):
|
||||
#get_window().size += Vector2i(100,90)
|
||||
|
||||
func open_menu():
|
||||
options_menu.show()
|
||||
|
||||
#
|
||||
#func _on_CloseButton_pressed():
|
||||
|
|
@ -24,3 +31,21 @@ func _process(_delta):
|
|||
#func _on_MinimizeButton_pressed():
|
||||
#OS.set_window_minimized(true)
|
||||
|
||||
|
||||
|
||||
func _on_popup_menu_id_pressed(id: int) -> void:
|
||||
if id == 2:
|
||||
get_window().size = Vector2i(200,180)
|
||||
options_menu.set_item_checked(2, true)
|
||||
options_menu.set_item_checked(3, false)
|
||||
options_menu.set_item_checked(4, false)
|
||||
elif id == 3:
|
||||
get_window().size = Vector2i(300,270)
|
||||
options_menu.set_item_checked(2, false)
|
||||
options_menu.set_item_checked(3, true)
|
||||
options_menu.set_item_checked(4, false)
|
||||
elif id == 4:
|
||||
get_window().size = Vector2i(400,360)
|
||||
options_menu.set_item_checked(2, false)
|
||||
options_menu.set_item_checked(3, false)
|
||||
options_menu.set_item_checked(4, true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue