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
6288739de0
commit
c7d49bc5cc
27 files changed
+304
-149
No files matched your search
+6
-10
@@ -1,4 +1,4 @@
|
||||
extends Control
|
||||
extends PopupWindow
|
||||
|
||||
@onready
|
||||
var winner_panel: Panel = %WinnerPanel
|
||||
@@ -23,6 +23,11 @@ func show_winner(winner: PlayerObject) -> void:
|
||||
winner_label.text = winner.player_name + " won with " + str(winner.player_score) + \
|
||||
" points!!"
|
||||
winner_picture.texture = winner.character
|
||||
# The "no character" placeholder is pixel art, which blurs when scaled up smoothly
|
||||
if winner.character.resource_path == PlayerObject.NO_CHARACTER_PATH:
|
||||
winner_picture.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
||||
else:
|
||||
winner_picture.texture_filter = CanvasItem.TEXTURE_FILTER_LINEAR
|
||||
winner_picture.custom_minimum_size = Vector2(480, 200)
|
||||
winner_picture.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
|
||||
winner_picture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
@@ -50,13 +55,4 @@ func show_winner(winner: PlayerObject) -> void:
|
||||
placing += 1
|
||||
|
||||
|
||||
func hide_window() -> void:
|
||||
visible = false
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if visible:
|
||||
if event is InputEventMouseButton and event.is_pressed():
|
||||
var ev_local: InputEvent = make_input_local(event)
|
||||
if !Rect2(Vector2(0, 0), winner_panel.size).has_point(ev_local.position):
|
||||
visible = false
|
||||
Reference in new issue
Block a user