extends Control var taskbar_height : int = 50 @export var bar: TextureProgressBar @export var label: Label @export var options_window: Window @export var bar_position : Position enum Position { Bottom, Right, Top, Left, } # Called when the node enters the scene tree for the first time. func _ready() -> void: setup_window() func setup_window(): var screen_size : Vector2i = DisplayServer.screen_get_size() # get current screen size var screen_pos : Vector2i = DisplayServer.screen_get_position(DisplayServer.SCREEN_OF_MAIN_WINDOW) # get the posiiton of the window on the virtual display get_window().min_size = Vector2i(1,1) # weird godot bug where the min screen size is 64x64 unless set in code if bar_position == Position.Bottom: get_window().size = Vector2i(screen_size.x, 10) # set window size to be 10 high and screen width wide DisplayServer.window_set_position(screen_pos + Vector2i(0,screen_size.y-10-taskbar_height)) # set position of window to be just above the taskbar position.y = 0 # set position of bar to be where it should be (moves when we change the window size) if bar_position == Position.Right: get_window().size = Vector2i(10, screen_size.y) # set window size to be 10 high and screen width wide size.x = screen_size.y - taskbar_height DisplayServer.window_set_position(screen_pos + Vector2i(screen_size.x-10,0)) # set position of window to be just above the taskbar position.y = 0 # set position of bar to be where it should be (moves when we change the window size) position.x = 10 rotation_degrees = 90 # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: var unix : float = Time.get_unix_time_from_system() var days : float = (Time.get_unix_time_from_system() + (60*60*10)) / 86400 # days since unix var offset : float = 0.5 # 0 = midday, 12 = midnight # bar should fill from 11:30pm (11.5) -> 1:30am (13.5) var current_day : float = fmod(days + offset,1) var mini_hour : float = 1.0/24.0 bar.max_value = mini_hour * 13.5 bar.min_value = mini_hour * 11.5 bar.value = current_day #label.text = Time.get_datetime_string_from_system() #Time. #print(current_day) if (bar.value >= 0.50): bar.modulate = Color.RED else: bar.modulate = Color.DODGER_BLUE #var screen_size : Vector2i = DisplayServer.screen_get_size() #DisplayServer.window_set_size(Vector2i(screen_size.x, 10)) #get_window().size = Vector2i(screen_size.x, 10) pass func _on_popup_menu_id_pressed(id: int) -> void: if id == 0: get_tree().quit() if id == 1: options_window.show()