forked from LGDG/ExampleProject
Compare commits
No commits in common. "1801c8e5ba633bf8add8d0072105f9eeb0f7d94f" and "6286d4338ae484d157c7ad661669819092e3a08f" have entirely different histories.
1801c8e5ba
...
6286d4338a
|
@ -7,3 +7,18 @@ var current_window: Control = the_game # current window
|
|||
func _ready() -> void:
|
||||
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true)
|
||||
|
||||
func _process(_delta):
|
||||
#get_window().grab_focus()
|
||||
pass
|
||||
|
||||
func _input(event: InputEvent):
|
||||
if event.is_action_pressed("HotKey_ToggleFullscreen"):
|
||||
# we can't maximize because godot considers borderless maximized to be fullscreen
|
||||
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
else:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,31 +7,13 @@ extends Control
|
|||
|
||||
var windowed_rect: Rect2
|
||||
|
||||
func get_descendants(node: Node) -> Array[Node]:
|
||||
var nodes: Array[Node] = []
|
||||
|
||||
for child in node.get_children():
|
||||
if child.get_child_count() > 0:
|
||||
nodes.append(child)
|
||||
nodes.append_array(get_descendants(child))
|
||||
else:
|
||||
nodes.append(child)
|
||||
|
||||
return nodes
|
||||
|
||||
func _ready() -> void:
|
||||
for descendant in get_descendants(self):
|
||||
descendant.gui_input.connect(_gui_input)
|
||||
|
||||
func _gui_input(event: InputEvent) -> void:
|
||||
func _input(event: InputEvent):
|
||||
if event is InputEventMouseButton:
|
||||
if event.pressed:
|
||||
if get_global_rect().has_point(get_global_mouse_position()):
|
||||
desktop.current_window = self
|
||||
get_parent().move_child(self, get_parent().get_child_count())
|
||||
|
||||
func _input(event: InputEvent):
|
||||
if event is InputEventKey:
|
||||
elif event is InputEventKey:
|
||||
if event.keycode == KEY_F11:
|
||||
if event.pressed:
|
||||
if desktop.current_window == self:
|
||||
|
|
Loading…
Reference in New Issue