Add a theme picker and an Original web theme (#42)
Settings has a Theme row listing Settings.THEMES: Classic (main_theme.tres, still the default) and Original web (original_web_theme.tres), which looks like MusicFrontend: orange-bordered buttons, a #333 header and popups, #424242 panels, #4e4e4e alternating rows, a yellow playing song and a light grey player bar. Picking one sets the root window's theme at once and saves it as theme_id in settings.cfg, and it is applied at start. The popup backdrop and score graph follow a theme switch. The top bar has its own TopBarBackground style. test_theme.gd checks that every theme has everything main_theme.tres has. The screenshot tool takes a theme id. Closes #42 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
70e970b24c
commit
94e8dfb602
15 files changed
+2497
-586
No files matched your search
@@ -143,6 +143,21 @@ theme_type_variation = &"HighlightMedium"
|
||||
text = "No pictures found"
|
||||
text_overrun_behavior = 3
|
||||
|
||||
[node name="ThemeRow" type="HBoxContainer" parent="SettingsPanel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Title" type="Label" parent="SettingsPanel/VBoxContainer/ThemeRow"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_type_variation = &"SettingsRowLabel"
|
||||
text = "Theme"
|
||||
|
||||
[node name="ThemeButton" type="OptionButton" parent="SettingsPanel/VBoxContainer/ThemeRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(180, 0)
|
||||
layout_mode = 2
|
||||
focus_mode = 0
|
||||
|
||||
[node name="FullscreenButton" type="CheckButton" parent="SettingsPanel/VBoxContainer" unique_id=400304684]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
@@ -27,5 +27,11 @@ static func add_to(parent: Control, popups: Array[BasePopup]) -> PopupBackdrop:
|
||||
return backdrop
|
||||
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
# The dimming colour comes from the theme, which can be switched in Settings
|
||||
if what == NOTIFICATION_THEME_CHANGED:
|
||||
color = get_theme_color(&"backdrop", &"Palette")
|
||||
|
||||
|
||||
func _update() -> void:
|
||||
visible = _popups.any(func(popup: BasePopup) -> bool: return popup.visible)
|
||||
@@ -19,6 +19,12 @@ var _history: ScoreHistory
|
||||
var _winning_score: int = 0
|
||||
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
# The colours come from the theme, which can be switched in Settings
|
||||
if what == NOTIFICATION_THEME_CHANGED:
|
||||
queue_redraw()
|
||||
|
||||
|
||||
## Shows [param history]. The y axis goes up to [param winning_score], or higher if
|
||||
## someone has more points. A winning score of 0 draws no winning line.
|
||||
func show_history(history: ScoreHistory, winning_score: int) -> void:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class_name SettingsPopup
|
||||
extends BasePopup
|
||||
## The application settings: which MusicServer or music folder to play from, fullscreen,
|
||||
## how many songs to download ahead, whether to prefer less played soundtracks and whether
|
||||
## plays count in the statistics, and a button that opens the folder the settings are
|
||||
## kept in. Opened from the Settings button in the top bar.
|
||||
## The application settings: which MusicServer or music folder to play from, the theme,
|
||||
## fullscreen, how many songs to download ahead, whether to prefer less played soundtracks
|
||||
## and whether plays count in the statistics, and a button that opens the folder the
|
||||
## settings are kept in. Opened from the Settings button in the top bar.
|
||||
##
|
||||
## A music folder (see [MusicFolder]) is used instead of the server until Use server is
|
||||
## pressed or the game is closed. The settings that need the server are off meanwhile.
|
||||
@@ -25,6 +25,7 @@ const PADDING: Vector2 = Vector2(20, 12)
|
||||
@onready var settings_panel: Panel = %SettingsPanel
|
||||
@onready var select_server_button: OptionButton = %SelectServerButton
|
||||
@onready var fullscreen_button: CheckButton = %FullscreenButton
|
||||
@onready var theme_button: OptionButton = %ThemeButton
|
||||
@onready var cache_label: Label = %CacheLabel
|
||||
@onready var lower_cache_button: Button = %LowerCacheButton
|
||||
@onready var increase_cache_button: Button = %IncreaseCacheButton
|
||||
@@ -56,6 +57,10 @@ var _panel_middle_y: float = 0.0
|
||||
func _ready() -> void:
|
||||
for server: String in Settings.servers:
|
||||
select_server_button.add_item(server)
|
||||
for entry: Dictionary in Settings.THEMES:
|
||||
theme_button.add_item(entry.name)
|
||||
theme_button.select(Settings.THEMES.find(Settings.theme_entry(Settings.theme_id)))
|
||||
theme_button.item_selected.connect(select_theme)
|
||||
fullscreen_button.button_pressed = Settings.fullscreen
|
||||
select_server_button.select(Settings.selected_server)
|
||||
cache_label.text = str(Playlist.number_of_tracks_to_preload)
|
||||
@@ -83,6 +88,11 @@ func _ready() -> void:
|
||||
_show_music_source()
|
||||
|
||||
|
||||
## Switches to the theme at [param index] in [constant Settings.THEMES] at once.
|
||||
func select_theme(index: int) -> void:
|
||||
Settings.apply_theme(Settings.THEMES[index].id)
|
||||
|
||||
|
||||
func fullscreen() -> void:
|
||||
Settings.set_fullscreen(!Settings.fullscreen)
|
||||
|
||||
|
||||
Reference in new issue
Block a user