Rework popups and fix blurry text and player list layout
Popups: - All nine popups now extend a shared PopupWindow class with open(), close() and toggle(), instead of each copying its own close-on-click code. Popups that need cleanup override close(). - A click outside a popup closed it and also pressed whatever was underneath, e.g. Reset playlist. The closing click is now consumed. - Popups used Godot's see-through default panel, so the song list and titles showed through. They now use an opaque popup theme, and a backdrop dims the window behind them. - The main window root now fills the screen, so the backdrop covers it. Text and images: - Many labels and buttons forced nearest filtering, which made text and icons jagged when the window is not 1920x1080. They now use the default smooth filtering. Only the pixel-art "no character" picture keeps nearest filtering when the winner window enlarges it. Player list: - A long player name pushed that row's character and buttons to the right. Names now take the free space and shorten with an ellipsis, so all rows line up and use the full width of the panel.
This commit is contained in:
1 parent
7beaa7ee5c
commit
65b73e3570
27 files changed
+304
-149
No files matched your search
+33
-11
@@ -140,11 +140,15 @@ var current_player: Node
|
||||
## True while statistics are off because a player won, until points are reset.
|
||||
var stats_paused_by_win: bool = false
|
||||
|
||||
## Dims the window behind an open popup and keeps clicks from reaching the buttons under it.
|
||||
var popup_backdrop: ColorRect
|
||||
|
||||
## Seconds to wait before retrying a song download step that failed.
|
||||
var song_fetch_retry_seconds: float = 5.0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
_setup_popup_backdrop()
|
||||
var debug: bool = OS.has_feature("debug")
|
||||
var is_mac: bool = OS.has_feature("macos")
|
||||
if debug:
|
||||
@@ -214,9 +218,9 @@ func _input(event: InputEvent) -> void:
|
||||
if Settings.fullscreen == false:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
if event.alt_pressed && event.keycode == KEY_K:
|
||||
shortcuts_window.visible = !shortcuts_window.visible
|
||||
shortcuts_window.toggle()
|
||||
if event.alt_pressed && event.keycode == KEY_L:
|
||||
log_window.visible = !log_window.visible
|
||||
log_window.toggle()
|
||||
|
||||
func server_updated() -> void:
|
||||
print("server_updated")
|
||||
@@ -277,6 +281,28 @@ func play_next_song() -> void:
|
||||
#"/music/rand"
|
||||
#"/music/addQue"
|
||||
#"/music/info"
|
||||
func _popups() -> Array[PopupWindow]:
|
||||
return [search_view, sync_window, settings_window, qr_window, new_character_select,
|
||||
shortcuts_window, about_window, winner_window, log_window]
|
||||
|
||||
# The backdrop sits above the main window and below every popup. Popups close
|
||||
# themselves when clicked outside, and the backdrop keeps that click from reaching
|
||||
# the buttons behind them.
|
||||
func _setup_popup_backdrop() -> void:
|
||||
popup_backdrop = ColorRect.new()
|
||||
popup_backdrop.name = "PopupBackdrop"
|
||||
popup_backdrop.color = Color(0, 0, 0, 0.55)
|
||||
popup_backdrop.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
add_child(popup_backdrop)
|
||||
popup_backdrop.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
for popup: PopupWindow in _popups():
|
||||
move_child(popup, -1)
|
||||
popup.visibility_changed.connect(_update_popup_backdrop)
|
||||
_update_popup_backdrop()
|
||||
|
||||
func _update_popup_backdrop() -> void:
|
||||
popup_backdrop.visible = _popups().any(func(popup: PopupWindow) -> bool: return popup.visible)
|
||||
|
||||
# The cache size can be changed in the settings. Waiting until the settings are closed
|
||||
# avoids starting downloads while the user is still clicking the number up and down.
|
||||
func _on_settings_window_visibility_changed() -> void:
|
||||
@@ -374,19 +400,19 @@ func reset_points() -> void:
|
||||
|
||||
func show_about() -> void:
|
||||
print("show_about")
|
||||
about_window.show_window()
|
||||
about_window.open()
|
||||
|
||||
func show_shortcuts() -> void:
|
||||
print("show_shortcuts")
|
||||
shortcuts_window.visible = true
|
||||
shortcuts_window.open()
|
||||
|
||||
func show_settings() -> void:
|
||||
print("show_settings")
|
||||
settings_window.visible = true
|
||||
settings_window.open()
|
||||
|
||||
func show_qr() -> void:
|
||||
print("show_qr")
|
||||
qr_window.show_window()
|
||||
qr_window.open()
|
||||
|
||||
func get_statistics() -> void:
|
||||
print("get_statistics")
|
||||
@@ -422,7 +448,6 @@ func get_suggestion_list() -> void:
|
||||
soundtracks.append_array(array)
|
||||
for soundtrack: String in soundtracks:
|
||||
var inspiration_label: Label = Label.new()
|
||||
inspiration_label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
|
||||
inspiration_label.add_theme_font_size_override("font_size", 20)
|
||||
inspiration_label.text = soundtrack
|
||||
inspiration_label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
@@ -514,10 +539,7 @@ func _on_new_character_selected(character_texture: ImageTexture) -> void:
|
||||
|
||||
func show_search() -> void:
|
||||
print("show_search")
|
||||
if search_view.visible == false:
|
||||
search_view.visible = true
|
||||
else:
|
||||
search_view.visible = false
|
||||
search_view.toggle()
|
||||
|
||||
|
||||
###Local
|
||||
|
||||
Reference in new issue
Block a user