mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-26 17:17:24 -04:00
windowed mode, initial screen settings
This commit is contained in:
parent
b9bb17e73f
commit
90ac30dd89
12 changed files with 233 additions and 65 deletions
|
@ -1,5 +0,0 @@
|
|||
extends BaseButton
|
||||
|
||||
|
||||
func _on_pressed() -> void:
|
||||
get_tree().quit()
|
|
@ -5,9 +5,23 @@ extends Control
|
|||
|
||||
func _ready() -> void:
|
||||
resized.connect(on_resized)
|
||||
set_initial_screen()
|
||||
on_resized()
|
||||
|
||||
|
||||
func on_resized() -> void:
|
||||
Debug.logclr("Ui resized: %dx%d" % [size.x, size.y], Debug.SILENT_CLR)
|
||||
ui_events.ui_size_changed_emit(size)
|
||||
|
||||
|
||||
func set_initial_screen() -> void:
|
||||
var last_screen = DataSaver.get_value("settings", "last_screen")
|
||||
if last_screen == null: last_screen = 0
|
||||
|
||||
DisplayServer.window_set_current_screen(last_screen)
|
||||
Debug.logclr("Initial screen: %d" % [last_screen], Debug.SILENT_CLR)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
var last_screen = DisplayServer.window_get_current_screen()
|
||||
DataSaver.set_value("settings", "last_screen", last_screen)
|
||||
|
|
17
app/scripts/ui/menu/window_buttons.gd
Normal file
17
app/scripts/ui/menu/window_buttons.gd
Normal file
|
@ -0,0 +1,17 @@
|
|||
extends Control
|
||||
|
||||
@export var minimize: BaseButton
|
||||
@export var exit: BaseButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
minimize.pressed.connect(on_minimize)
|
||||
exit.pressed.connect(on_exit)
|
||||
|
||||
|
||||
func on_minimize() -> void:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_MINIMIZED)
|
||||
|
||||
|
||||
func on_exit() -> void:
|
||||
get_tree().quit()
|
|
@ -2,6 +2,7 @@ extends TextureRect
|
|||
class_name SplashScreen
|
||||
|
||||
@export var gate_events: GateEvents
|
||||
@export var command_events: CommandEvents
|
||||
@export var ui_events: UiEvents
|
||||
@export var splash_screen: Texture2D
|
||||
|
||||
|
@ -12,6 +13,7 @@ class_name SplashScreen
|
|||
func _ready():
|
||||
gate_events.gate_info_loaded.connect(show_thumbnail)
|
||||
gate_events.gate_entered.connect(show_splash_screen)
|
||||
command_events.first_frame_drawn.connect(first_frame_drawn)
|
||||
|
||||
# Change size
|
||||
show_splash_screen()
|
||||
|
@ -34,6 +36,10 @@ func show_splash_screen() -> void:
|
|||
self.texture = ImageTexture.create_from_image(image)
|
||||
|
||||
|
||||
func first_frame_drawn() -> void:
|
||||
hide()
|
||||
|
||||
|
||||
func resize_and_convert(image: Image, format: Image.Format) -> Image:
|
||||
image.resize(width, height)
|
||||
image.convert(format)
|
||||
|
|
|
@ -21,4 +21,4 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func animate(value: float) -> void:
|
||||
custom_minimum_size.x = lerp(initial, full_screen, value)
|
||||
custom_minimum_size.x = lerp(initial, full_screen + 1, value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue