Files
MusicPlayer/quiz/song_row.gd
T
Sansan 8b71723a34
Build / test (pull_request) Successful in 31s
Build / build (pull_request) Skipped
Build / test (push) Successful in 31s
Build / build (push) Successful in 1m13s
Put the whole look into one project theme
themes/main_theme.tres is the project theme. It holds Godot's default look for
every control type the game uses, plus named styles for the game's own look
(popups, the background, spacers, list rows, title and text sizes, highlights)
and a palette for the popup dimming. Scenes and scripts name these styles
instead of setting colours, sizes or style boxes, and the five old theme files
are gone. themes/README.md explains the styles and how to make a new theme.

The screenshot tour now uses the real character pictures, so the layout
baseline is taken again. Screenshots are pixel-identical to before, and
test_theme.gd checks that the look stays in the theme.
2026-10-06 13:33:35 +02:00

38 lines
1.3 KiB
GDScript

class_name SongRow
extends PanelContainer
## One song in the music list: its number, soundtrack and title, and a marker for
## each player who got a point for it.
var song_object: SongObject
@onready var song_list_label: Label = %SongListLabel
@onready var song_list_players: HBoxContainer = %SongListPlayers
func _ready() -> void:
set_label()
update_players()
func set_label() -> void:
if song_object != null:
var size_to_change: int = song_object.players_given_point.size() * 50
song_list_label.custom_minimum_size = Vector2(1000 - size_to_change, 28)
if song_object.is_playing:
song_list_label.theme_type_variation = &"SongRowLabelPlaying"
song_list_label.text = song_object.get_song_info()
func update_players() -> void:
Settings.delete_children(song_list_players)
if song_object != null:
# Show players in the same order as the player list
for player: PlayerObject in Settings.player_array:
if song_object.players_given_point.has(player.id):
var texture: TextureRect = TextureRect.new()
texture.texture = player.character
texture.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
texture.custom_minimum_size = Vector2(50, 25)
song_list_players.add_child(texture)